I'm writing a Python translator. According to what I discovered after reading this post, this translator will transform a standard text into one with some unique features.
We append "S" at the beginning of each word.
We append "Di" at the end of each word.
Each word example is reversed: Hello Everyone --> SHello SEveryone --> SHelloDi SEveryoneDi --> SHelloDi SEveryoneDi —> iDenoyrevES iDolleHS
The first two sections were simple for me; however, the third portion is a little tough for my code.
Code: Select all
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
I'd want to implement something like this in the pass section xi. append(j) and then we reverse it.
How do I go about doing this?
Thanks you