Use recursion to determine the nth term of an arithmetic series. Parameters: starting term, common difference, n. The formula for the nth term is an = an - 1 + d.
Write a lambda that checks if a tuple of integers is a square.
Resources:
Class slides: https://docs.google.com/presentation/d/1iC-GsI2-bK96kdQ32hbrf3g2BuOeObFAIWCFFZOsop4/edit?usp=sharing
Class code: https://replit.com/join/ywxsbaugeu-shravyas
Contact Info:
shravyassathish@gmail.com (mentor)
kingericwu@gmail.com (TA)
felixguo41@gmail.com (TA)
def function(start, diff, n):
print(f"start:{start}, diff:{diff}, n:{n}")
if n == 0:
return start
start = start - 1 + diff
return function(start, diff, n-1)
print(function(10, 3, 4))
#2
x = lambda a,b:a==b**2
print(x(4,2))
print(x(9,3))
print(x(10,5))