def adder(num1, num2): return (num1+num2) def avg(scores_to_avg): size = len(scores_to_avg) sum = 0 for i in range(size): sum = sum + scores_to_avg[i] avg = sum/size return avg def createList(): list = [90, 87, 99, 94] return list def getListFromUser(): list = [] numtoenter = input("Enter the number of numbers you'd like to input: ") x = 0 while x < numtoenter: num = input("Enter number: ") list.append(num) x = x + 1 return list #input: [4, 6, 8] #side effect #Element number 1 is 4 #Element number 2 is 6 #Element number 3 is 8 def printList(list): length = len(list) x = 0 while x < length: print "Element number ", (x+1), " is ", list[x] x = x + 1 def getMax(list): #initialize highest highest = list[0] #for each number in list # if larger than highest # change highest to be current number x = 1 while x < len(list): if list[x] > highest: highest = list[x] x = x + 1 return highest result = createList() max = getMax(result) print max #print result #result = adder(5, 6) #print "Result of adding 5 and 6 is: ", result #scores=[90, 67, 98, 87] #result = avg(scores) #print "The average of the scores in the list scores is: ", result #print scores #result = adder(scores[0], scores[1]) #print result #first_scores=[90, 56, 87, 54, 77, 65] #second_scores=first_scores #print second_scores #first_scores[3] = 9999 #print second_scores #all_scores = first_scores+second_scores #print all_scores #del all_scores[2:5] #print all_scores #for i in range(len(all_scores)): # all_scores[i] = 0 #yourscore = 98 #all_scores.append(98) #print len(all_scores) #print all_scores #mystring = "san francisco" #mylist = [4, 7, 3, 6, 3, 2, 6, 10] #x = 0 #mylistlength = len(mylist) #option 1 #while x < mylistlength: # print mylist[x] # x = x + 1 #option 2 #for i in range(len(mylist)): # print mylist[i] #option 3 #for j in mylist: # print j