Reverse: this excercise is the bane of my life


it says:
Does your reverse function take exactly one argument (a string)? Your code threw a "'int' object is not iterable" error.

def reverse(text):
    space = ""
    n = len(text) - 1
    for i in len(text):
        space += text[n]
        n -= 1
    return space



for i in len(text):

len() will give an integer, you can't iterate over a integer


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.