Reverse: this excercise is the bane of my life


#1



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):
    list(text)
    space = ""
    n = len(text) - 1
    for i in len(text):
        space += text[n]
        n -= 1
    return space


#2

here:

for i in len(text):

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


#3

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