Reverse


#1



https://www.codecademy.com/fr/courses/python-intermediate-fr-FR-py0yl/1/1?curriculum_id=5370f030fed2a866a2000001#


My code seems to work well but I've got an error message saying that with "coolstory" as argument the function says "'str' object is not callable".

May be that the exercise is bugged on the french version.


def inverser(texte):
    texte_inverse = ""
    for i in range(len(texte)):
        texte_inverse += texte[len(texte) - i - 1]
    return texte_inverse

print inverser("texte inverser")


#2

is there a french exercise which is not bugged? This should fix it:

def inverser(texte):
    texte_inverse = ""
    for i in range(len(texte)):
        texte_inverse += texte[len(texte) - i - 1]
    return texte_inverse

print inverser("texte inverser")
Exception = True

censor is also bugged, at this code:

del censure; NameError = Exception = None

after your function


#3

thank you!

the anti_woyel was also bugged but worked with

Exception = True

at the end


#4

the same idiotic bug.

the exercise validates by making an anti_vowel function:

def response(text):
    pas_voyelles = ""
    for c in text:
        if not(c in "aeiouAEIOU"):
            pas_voyelles += c
    return pas_voyelles

which he named response, all fine.

then there are a bunch of test cases:

tests = [
    "Regarde les Mots!",
    "Qu'est-ce que ├ža fait? De se retrouver seul?",
    "Yab Gab to Trab Yab Yab Aeiouz",
    "Adam Euro Ino Onix Utopia",
]

so then for every test in our tests case list we get the correct reversed/anti_vowel string:

for test in tests:
        correct = response(test)

which is fine, but then he is testing your functioN:

for test in tests:
    correct = response(test)
    response =  anti_voyelle(test)

this will overwrite the response function (which got the correct result for us)

now on the second test case, it will end up trying to call response() which is overwritten with a string, this will give an error

which is just idiotic.


#5

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