I have to find the sum of a range between the values a and b, although either can be a negative number. If they are the same number I should just return that number. A complete beginner here. Stuck on a Code-Wars kata.
Apparently, my code returns None. I don't necessarily want the solution to the problem. I more want to know why my code is wrong. (The first line of the code is given)
def get_sum(a,b):
if a == b:
return a
num = 0
if a > b:
for i in range(a, b):
num += i
return num
elif a < b:
for i in range(b, a):
num += i
return num