Pyglatin - Check Yourself... Some More


Here's my code so far:

print 'Welcome to the Pig Latin Translator!'

# Start coding here!
original = raw_input("Enter a word: ")
print original

if len(original) > 0 and original.isalpha():
    print original
    print "empty"

When I test the program, I get:

Welcome to the Pig Latin Translator!
Enter a word: 12df

I can't figure out why it prints "12df" after I enter it in. Is there something off about my if statement?


Because you have a print statement that runs right after the raw_input.


@codecadet101 It is printing back the word you gave it because of this line:

The variable original stores the user's input, aka what they wrote when Python asks "Enter a word", the next line is telling you to print original, so it will display what the user says right back. Everything is normal in that. :slight_smile:

Hope that helps! Good luck and happy coding!

-- @chipjumper36731


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