I am creating a translator in python . This translator is going to change a normal text to a text with some special things :
- At the first of each word we add "S"
- At the End of each word we add "Di"
- We reverse each word
example : Hello Everyone --> SHello SEveryone --> SHelloDi SEveryoneDi --> iDolleHS iDenoyrevES
I did first two parts easily; but third part is a little tricky my code :
n = input("Enter Text : ")
y = n.split()
z = 0
for i in y:
x = str("S" + i)
y[z] = x
z = z + 1
z = 0
for i in y:
x = str(i + "Di")
y[z] = x
z = z + 1
print(y)
z = 1
for i in y:
globals()["x%s" % z] = []
for j in i:
pass
In pass part I wanna to do something like this x{i}.append(j)
and then we reverse it.
How do I do this?