Im writing a program for french that turns present tense verbs into past tense. The problem is that I need to replace letters but they are user inputed so I have to have it replacing the letters from the end of the line. Here's what I have so far, but it doesn't change the letters it just gives an error:
word = raw_input("what words do you want to turn into past tense?")
word2= word
if word2.endswith("re"):
word3 = word2.replace('u', 're')
print word3
elif word2.endswith("ir"):
word2[-2:] = "i"
print word2
elif word2.endswith("er"):
word2[-2:] = "e"
print word2
else:
print "nope"
I tried word replace and that doesn't work either, it just gives me back the same string. If some one could just give me an example and maybe explain it a little that would be awesome. :/