def findmax():
    numvalues = input("Enter number of values: ")
    max_so_far = 0
    for times in range(numvalues):
        n = input("Enter a positive integer: ")
        if n > max_so_far:
            max_so_far = n
    print "The highest values was", max_so_far

def findmax2():
    max_so_far = 0
    n = input("Enter a positive integer (or 0 to quit): ")
    while n != 0:
        if n > max_so_far:
            max_so_far = n
        n = input("Enter a positive integer (or 0 to quit): ")
    print "The highest values was", max_so_far

def prime():
    consider = input("Enter an integer greater than 1: ")
    divisor = 2
    while divisor < consider and consider % divisor != 0:
        divisor = divisor + 1
    if divisor == consider:
        print consider, "is PRIME"
    else:
        print consider, "is COMPOSITE"

def prime2():
    highest = input("Enter highest integer to check: ")
    consider = 2
    while consider <= highest:
        divisor = 2
        while divisor < consider and consider % divisor != 0:
            divisor = divisor + 1
        if divisor == consider:
            print consider
        consider = consider + 1

def prime3():
    numprimes = input("Enter desired number of primes: ")
    primesfound = 0
    consider = 2
    while primesfound < numprimes:
        divisor = 2
        while divisor < consider and consider % divisor != 0:
            divisor = divisor + 1
        if divisor == consider:
            print consider
            primesfound = primesfound + 1
        consider = consider + 1

def calendar():
    numdays = input("Enter number of days in month: ")
    startday = input("Enter day number that month starts (0 = Sunday): ")
    print " S  M  T  W  T  F  S"
    #Suppose startday is 4
    #The first four days of the calendar page will belong to the previous month.
    #I will pretend those are days number -3, -2, -1, 0.
    #I will print blanks for those numbers.
    date = 1 - startday
    daysinweek = 0 #number of days printed for current week
    while date <= numdays:
        if date >= 10:
            print date,
        else:
            if date > 0: #from 1 to 9
                print "", date, #precede with a space
            else:
                print "  ", #just leave space for day before month
        daysinweek = daysinweek + 1
        if daysinweek == 7:
            print "" #print next date on new line
            daysinweek = 0
        date = date + 1
