Translator not working



pyg = 'ay'

original = raw_input('Enter a word:')

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

it prints ‘empty’ no matter what I put in when I run it


what do you enter? spaces are not alphanumeric characters, so after the word hit enter right away without typing a space


so I tried to write a word without a space and instead of printing ‘empty’ it’s nothing now


there are no print statement reached when you enter a valid word, so it shows nothing, that is how you coded it


Hey albtoul.

At your 7th line "new_word = new_word[1:len(new_word)] you forgot to make a print statement underneath it.
Make a new line under it and type “print new_word”.

Good luck.


You should
print new_word
new_word = new_word[1:len(new_word)]


I really wish they put this in the actual lesson because i was about to continue without it even working so there would be no point. Thank you my guy.


what is the point of

new_word = new_word[1:len(new_word)]

if the program works fine without it?


You would have to have new_word = new_word[1:] to make sure you have removed the first letter of the word.

With the line specified:

Enter a word:test

Without the line:

Enter a word:test

As you can see, leaving out that line would indeed break the translator.


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