My code is correct but i was wondering how can I add raw input to that code so that a user could type a word
normally and it will come out in reverse?

def reverse(text):
    key = ""
    index = len(text)
    for i in range(0, index):
        key = key + text[(index - 1) -i]
    return key


you can add a raw_input before your function:

user_input = raw_input("enter a string you want reversed")
def reverse(text):

and then pass user_input as argument in the function call:

    return key
print reverse(user_input)


2 posts were split to a new topic: Reverse


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