I'm trying to design a function that accepts a list of numbers as an argument. I can get the program working when i put a list into the programme but I can't figure out how to allow a user to enter a series. What i've got so far is below. Any help would be appreciated.
def main():
list= [2, 4, 6, 8, 9, 12, 6, 10, 9, 6, 7 ]
my_sum = sum(list)
# Display the sum
print "The sum of numbers in the list is", my_sum
def sum(list):
if list == []:
return 0
else:
return list [0] + sum (list[1:])
main()