# Homework #3
# YOUR NAME AND EMAIL HERE
import math


# returns a constrained value of x
# assume a < b
# x, if x between a and b
# a, if x is less than or equal to a
# b, if x is greater than or equal to b
# don't use any predefined Python functions!
def constrain(x,a,b):
  # your code here
  return -1


# returns the name of the digit:
# Assume 0 <= d <= 9
# 'zero', when d is 0
# ...
# 'nine', when d is 9
# don't use any predefined Python functions!
def digitName(d):
  # your code here
  return -1

# assume n is an integer, do all computations as integers
# returns 
# n divided by 2, when n is even
# 3 times n plus 1, when n is even
# don't use any predefined Python functions!
def collatz(n):
  # your code here
  return -1

# return True if the point (x,y) is inside or on the boundary of
# a circle or radius r centered at the point (a,b)
# See lab page for the math
# don't use any predefined Python functions!
def inCircle(x, y, a, b, r):
  # your code here
  return -1

# return True if c is a letter a-z or A-Z
# it is not a letter if c has more than one character
# use the len() function; don't use any other predefined Python functions!
def isLetter(c):
  # your code here
  return -1

# return True if c is a digit 0-9
# it is not a digit if c has more than one character
# use the len() function; don't use any other predefined Python functions!
def isDigit(c):
  # your code here
  return -1




# main function for testing
def main():
    print("Homework #3")
    
    print("constrain:")
    print(constrain(-10, 1, 100), "should be 1")
    print(constrain(1, 1, 100), "should be 1")
    print(constrain(10, 1, 100), "should be 10")
    print(constrain(100, 1, 100), "should be 100")
    print(constrain(1000, 1, 100), "should be 100")
    
    print("digitName:")
    print(digitName(0), "should be zero")
    print(digitName(2), "should be two")
    print(digitName(5), "should be five")
    print(digitName(9), "should be nine")
    
    print("collatz:")
    print(collatz(7), "should be 22")
    print(collatz(22), "should be 11")
    print(collatz(11), "should be 34")
    print(collatz(34), "should be 17")
    print(collatz(17), "should be 52")
    print(collatz(52), "should be 26")
    print(collatz(26), "should be 13")
    print(collatz(13), "should be 40")
    print(collatz(40), "should be 20")
    print(collatz(20), "should be 10")
    print(collatz(10), "should be 5")
    print(collatz(5), "should be 16")
    print(collatz(16), "should be 8")
    print(collatz(8), "should be 4")
    print(collatz(4), "should be 2")
    print(collatz(2), "should be 1")
    
    print("inCircle:")
    print(inCircle(3,2,3,2,5), "should be True")
    print(inCircle(0,0,3,2,5), "should be True")
    print(inCircle(5,0,3,2,5), "should be True")
    print(inCircle(5,5,3,2,5), "should be True")
    print(inCircle(6,6,3,2,5), "should be True")
    print(inCircle(-2,2,3,2,5), "should be True")
    print(inCircle(5,7,3,2,5), "should be False")
    print(inCircle(-5,5,3,2,5), "should be False")
    
    print("isLetter:")
    print(isLetter('a'), "should be True")
    print(isLetter('A'), "should be True")
    print(isLetter('z'), "should be True")
    print(isLetter('Z'), "should be True")
    print(isLetter('1'), "should be False")
    print(isLetter(' '), "should be False")
    print(isLetter(' '), "should be False")
    print(isLetter('^'), "should be False")
    print(isLetter('~'), "should be False")
    print(isLetter('computer'), "should be False")
    
    print("isDigit:")
    print(isDigit('0'), "should be True")
    print(isDigit('1'), "should be True")
    print(isDigit('2'), "should be True")
    print(isDigit('...'), "should be False")
    print(isDigit('9'), "should be True")
    print(isDigit('10'), "should be False")
    print(isDigit('A'), "should be False")
    print(isDigit('z'), "should be False")
    print(isDigit('~'), "should be False")
    
    

# call the main function
main()
