avatar Bite 1. Sum n numbers

Write a Python function that calculates the sum of a list of numbers:

  • The function should accept a list of numbers and return the sum of those numbers.
  • If no argument is provided (that is, numbers is None), return the sum of the numbers 1 to 100 (Note that this is not the same as an empty list of numbers being passed in. In that case the sum returned will be 0).

Have fun!

Login and get coding
go back Beginner level
Bitecoin 2X

3707 out of 4374 users completed this Bite.
Will you be Pythonista #3708 to crack this Bite?
Resolution time: ~25 min. (avg. submissions of 5-240 min.)
Pythonistas rate this Bite 3.54 on a 1-10 difficulty scale.
» You can do it! 😌

Focus on this Bite hiding sidebars, turn on Focus Mode.
We use Python 3.8