how do I Write using python a function, sum(a), that takes an array, a, of numbers and returns their sum?
I tried this but i am unable to figure out how get the user input of the array of number this is what i have so far
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You take the built-in function
sum():From the documentation:
If the user input is in the form of strings, you need to turn those into integers first. A generator expression could do that for you: