I'm somewhat of a noob to python but I'm trying to create a recursive function which works just like the built in range function:
def Range (lo, hi):
if lo >= hi:
return []
else:
return [lo, Range (lo+1,hi)]
but its returning multiple lists.
Instead of [3,4,5,6]
, which is what I want, its returning [3,[4,[5,[6,[]]]]]
Why is this and how do I fix it?