7. Reverse


#1




I am a total newbie about coding and because of that i have the feeling that i am cheating on this exercise...i mean...the use of [::-1] it's forbidden but i solved using my code below.


so my question is, did i actually cheat through it?


def reverse(text):
    temp = range((len(text)-1),-1,-1)
    rtext= []
    for n in temp:
        rtext.append(text[n])

    result = ''.join(rtext)
    return result


#2

well the use of [::-1] would make it very easy:

def reverse(text):
    return text[::-1]

this is cheating. What you did involved finding a way to reverse the string yourself, that is not cheating.


#3

thank you! now i have a solid confirmation that i did it in a legit way :smile::sunglasses:


#4