Pyg Latin #11


The pyg latin translator isn’t properly functioning it doesn’t deliver any outputs.

pyg = 'ay'

original = raw_input('Enter a word:')

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


What do you mean by that? Do you mean it’s not printing anything? Well that’s because you haven’t used a print statement to do so. You used it just fine in your else statement.


i just added print “original” to line 4 but it said name ‘word’ is not defined and to file ‘python’ in line 6


Yes, this means we didn’t declare word before our new_word variable/reassignments. So both first and word should of been declared before that (new_word). Basically, those two variables didn’t exist until a couple lines later. Always check the error code you’re given, it helps/shows you how to fix your problem. :slight_smile:


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