Why do I Get `ythonpa` Instead of `ythonpay` When I Enter `Python`?


Why when I do

pyg = 'ay'

original = raw_input('Enter a word:')

if len(original) > 0 and original.isalpha():
  word = original.lower()
  first = word[0]
  print new_word
  print 'empty'

I get ythonpa for Python instead of ythonpay?

How can I know if my translator works properly?

Hi @blonpina

When I ran your code, it gave me an error on line 8 since you can’t use a variable in the creation of itself. So try changing the end of that line to just this:


Doing that will remove the first letter and make the program run properly. After making that change, your code worked fine for me and returned ythonpay when I entered Python.


This topic is solved.