
Function basics
More advanced concepts


Perfect! Now, it's your turn to write a function that returns None.


Write a function named sum_between that will take two arguments – a and b – and will return the sum of all integers from a to b (inclusive). For instance:

sum_between(1, 4) = 1 + 2 + 3 + 4 = 10

However, if b < a, return None. Test your function by computing the sum of numbers between 1 and 3.

Stuck? Here's a hint!

Use a loop:

for i in range (a, b+1):