# some more functions and while loops def f(a): a = a+1 a = 3 f(a) print a # function to add up all the elements of an array A # sum([3,4,7,1]) should return 15 def sum(A): n = len(A) i = 0 # loop counter ax = 0 # running total while i1: ax = ax *n n = n-1 return ax # end factorial # function to compute the greatest common divisor of two numbers: def gcd(a,b): while a!=0 or b!=0: if a>b: a = a % b else: b = b % a # while return a+b # the 0 value will automatically be canceled out #gcd ####### from class: # function to return day of week: def dw(day,start): #usage: dw(14,"Wednesday") returns "Tuesday" D = ["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"] # find start date index: si = 0 while (si6): si = 0 # reset to Monday print "" # new line # while day #printcal