Challenge yourself

Beginner
Intermediate
Expert

Define a function, add, which takes two numbers, a and b, and returns their sum.


Define a function, add_up_to, which takes one positive integer, n, and returns sum of all numbers between 0 and n (inclusive). Example:

>>> add_up_to(4)
10 >>>

Restrictions:
  - You cannot use range
  - You cannot use +
  - You cannot use sum