2011-03-30, 07:44 PM
New problem: Making the program print a certain number of items per line. Unfortunately I deleted my program that did this, and threw out the print-out when I was cleaning drawers and binders. The program works except for printing the items. I need it to print all the elements of 'lst' but only 7 per line, forwards and backwards.
Here it is:
Here it is:
Code:
lst = []
resp = raw_input("Enter a number to continue or n to exit: ")
while resp[0].lower() != "n":
lst.append(int(resp))
resp = raw_input("Enter a number to continue or n to exit: ")
print
print lst
print
lst.reverse()
print lst
print
sm = sum(lst)
print "The sum of the list is ", sm
print
avg = float(sm) / (len(lst))
avg = round(avg, 3)
print "The average of the list is ", avg
print
print "The largest number in the list is ", max(lst)
print
print "The smallest number in the list is ", min(lst)
