Using Python 3, define the mySum function that is supposed to return the sum of a list of numbers (and 0 if that list is empty), but it has one or more errors in it. Write test cases to determine what errors there are.
Added by Joshua S.
Step 1
Define the function mySum with a parameter called numbers. Show more…
Show all steps
Your feedback will help us improve your experience
Akash M and 97 other AP CS educators are ready to help you.
Ask a new question
Labs
Want to see this concept in action?
Explore this concept interactively to see how it behaves as you change inputs.
Key Concepts
Recommended Videos
Write a method called sum that returns the sum of all values in the list. For example, if a variable called list stores [11, -7, 3, 42, 0, 14], the call of list.sum() should return 63. If the list is empty, sum should return 0.
John B.
def counting(n): for i in range(1, n): print(i)
Willis J.
Recommended Textbooks
Computer Science and Information Technology
Introduction to Programming Using Python
Computer Science - An Overview
Transcript
Watch the video solution with this free unlock.
EMAIL
PASSWORD