PygLatin - Check Yourself!


#1

This is the code I have, but when I type in a word and press enter, the program just keeps spinning. I don't get an error or anything; it is just stuck. Have I done something wrong?

print 'Welcome to the Pig Latin Translator!'

original = raw_input("Enter a word:")
if len(original) > 0:
print original
else:
print empty


#2

I'm assuming that your if/else has all the proper indents. If so, I don't see why it wouldn't work, it works fine for me. Have you tried reloading the page? You may also want to try leaving the exercise and going back in.


#3

Please format your code correctly next time!

This may be a loading error as @mkordik suggests, but it seems you are trying to print a variable called empty that you never declare. That would produce an error, however. Either way, attempt to fix that. Good luck.


#4

Thank you. I will try that.


#5

I defined

empty = ""

and that did not work either


#6

And refreshing the page didn't work either?


#7

Okay, it seems like it's a loading error then. Try working on a different wifi network if possible. If nothing works, this webpage should help you report the glitch to Codecademy officials.


#8

empty isn't a variable. So it should be
print("empty")


#9

Try deleting brackets and their content when you define the variable -original-, like this: original=raw_input
If you don't do this, the program asks again to give it the name/word: it gets confused because you have already given a name before.


#10

empty is not a variable like original. It is a string and needs to be in quotes.


#11

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