import math

def distance(x1, y1, x2, y2):
    """
    Calculates the distance between the points <x1, y1> and <x2, y2>
    """
    dist = math.sqrt((x1 - x2)**2 + (y1 - y2)**2)
    return dist

def circle_area(radius):
    """
    Calculates the area of the circle with radius 'radius'.
    """
    return math.pi * radius**2

def triangle_area(base, height):
    """
    Calculates area of triangle with base 'base' and height 'height.
    """
    return 0.5 * base * height

def is_right_triangle(a, b, c):
    """
    Says whether or not abc is a right triangle.
    """
    return a**2 + b**2 == c**2

def shipping_calculator(num_books, price):
    """ 
    Takes book price 'price' and book quanity 'num_books' and calculates the
    total cost to purchase/ship the books. Shipping costs $3 for the first book,
    and 75 cents for each additional book.  Also, since this calculator is meant
    for use at a bookstore, keep in mind that the store gets a 40% discount
    on each copy.
    """
    total_price_of_books = num_books * price * 0.6
    shipping_cost = 3 + 0.75 * (num_books - 1)
    return total_price_of_books + shipping_cost

def is_divisible(numerator, denominator):
    """
    Says whether or not numerator is divisible by denominator.
    """
    #return numerator/denominator == int(numerator/denominator)
    return numerator % denominator == 0


def print_grid():
    #string = '+' + times_four('-') + '+' + times_four('-') + '+\n'
    #string += '|' + times_four(' ') + '|' + times_four(' ') + '|\n'
    #string += '|' + times_four(' ') + '|' + times_four(' ') + '|\n'
    #string += '|' + times_four(' ') + '|' + times_four(' ') + '|\n'
    #string += '|' + times_four(' ') + '|' + times_four(' ') + '|\n'
    #string += '+' + times_four('-') + '+' + times_four('-') + '+\n'
    #string += '|' + times_four(' ') + '|' + times_four(' ') + '|\n'
    #string += '|' + times_four(' ') + '|' + times_four(' ') + '|\n'
    #string += '|' + times_four(' ') + '|' + times_four(' ') + '|\n'
    #string += '|' + times_four(' ') + '|' + times_four(' ') + '|\n'
    #string += '+' + times_four('-') + '+' + times_four('-') + '+\n'
    string = two_strings14('+', '-')
    string += (two_strings14('|', ' ') * 4)
    string += two_strings14('+', '-')
    string += (two_strings14('|', ' ') * 4)
    string += two_strings14('+', '-')
    return string

def print_alt_grid():
    string = two_strings14('+', '*')
    string += (two_strings14('*', ' ') * 4)
    string += two_strings14('+', '*')
    string += (two_strings14('*', ' ') * 4)
    string += two_strings14('+', '*')
    return string
    
    
"""    return
+----+----+
|    |    |
|    |    |
|    |    |
|    |    |
+----+----+
|    |    |
|    |    |
|    |    |
|    |    |
+----+----+
"""

def times_four(string):
    return string * 4

def two_strings14(string1, string2):
    return string1 + times_four(string2) + string1 + times_four(string2) + string1 + '\n'
