I want to build a function that takes two natural numbers n and m and returns a tuple of the squares of all the natural numbers starting with n and ending with m-1. I am able to decide if the function should return if m is smaller than n, but it shouldn't crash or return some sort of error message. So squares_tuple(3,7) returns (9,16,25,36) and rec_range(10,11) returns (100,). Also, I do not want to use range(), map(), loops, or lists. Here is what I have so far:
def squares_tuple(n,m):
"""takes two nat nums n and m and returns a tuple of the squares of all the
natural numbers starting with n and ending with m-1
nat, nat -> tuple of natural numbers"""
if m >= 0:
return 0
else:
return squares_tuple(n - 1, ) + (n**m, )
Kind of stuck at this point...