Hi, I'm studying for a final exam and I just wanted to ask if you could be so kind to explain how you get these answers from these questions. I'm really confused on them. Thanks!
1) What is the output of the following program?
def f(x, y):
if y == 0:
return x
else:
return f(y, x%y)
print(f(240, 150))
Answer: 30
2) What is the output of the following program?
num = 0
for i in range(0,10,1):
if (i%2 == i%3):
num = num + 1
print(num)
Answer: 4