am trying to make my own function of fibonacci, however, I keep getting the error in the title, why an integer is not iterable, and how can I make this function work? any alternative solution? it seems that I always have problems with lists being strictly string. I tried converting it to an integer by using
a = int(list(n))
but I still get the same error...
num = 10
def fibonacci(n):
#complete the recursive function
for i in range(n):
counter = 0
counter2 = -1
a = list(n)
if counter2 == -1:
print(a[counter])
counter += 1
counter2 += 1
else:
print(a[counter] + a[counter2])
counter += 1
counter2 += 1
fibonacci(num)