I would like to modify this code so that instead of me calling the function with the list as shown [1,2,3,4], the user inputs the list with raw_input.
Thanks in advance """Define a function sum() and a function multiply() that sums and multiplies (respectively) all the numbers in a list of numbers. For example, sum([1, 2, 3, 4]) should return 10, and multiply([1, 2, 3, 4]) should return 24.""" def sum(mylist = [], *args): print mylist sum_of_number = 0 for i in mylist: sum_of_number += i print "The sum of the digits in your number is %s" %(sum_of_number) def multiply(mylist = [], *args): product_of_number = 1 for i in mylist: product_of_number = product_of_number * i print "The product of the digits in your number is %s" %(product_of_number) sum([1,2,3,4]) multiply([1,2,3,4]) -- This is a staff email account managed by Simcoe Muskoka Catholic District School Board. This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the sender. _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor