Checked the other threads: Help with Check it yourself!


#1


Thanks in advance for your help. The code below is good enough to pass the screen to the next lesson, but it's not acting right. The problem is that it requires two return hits to work. Here's what's happening:

Welcome to the Pig Latin Translator!
Enter a word:
// I enter an appropriate string, then hit Enter.
// It displays the string, then waits. If I hit Enter again, it outputs, "empty." If I type in another string, it displays that string too.

I'm pretty sure I need some kinda return command in there but I'm not sure how to.

Here's my code:

print 'Welcome to the Pig Latin Translator!'

raw_input("Enter a word:")
original = raw_input()

if len(original) > 0:
print original
else:
print "empty"

I've fiddled around a bit with it, but all I get are errors.

Thanks much for your help!


Replace this line with your code.


#2

We only need one call to raw_input()

original = raw_input("Enter a word:")

Remove the first line.


#3

Yup. That did it. Makes sense too. Question answered. Thank you kindly internet stranger!


#4

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