PygLatin 4/11


#1

codecademy recognizes the task as complete, but I don’t think it is working properly.

This is my code:
print ‘Welcome to the Pig Latin Translator!’

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

This is what it returns:
Welcome to the Pig Latin Translator!
Enter a word:hi
Enter a word:hi
hi

or

Welcome to the Pig Latin Translator!
Enter a word:
Enter a word:
empty

Why does the “Enter a word” thing show up twice? Shouldn’t it be:
Welcome to the Pig Latin Translator!
Enter a word: hi
hi

or

Welcome to the Pig Latin Translator!
Enter a word:
empty


#2

raw_input() is the function which prompts you for input, you have a twice, so its prompting you for input twice

the first raw_input (line 1), you don’t do anything with the returned result by raw_input(), so if you plan on removing one, i would recommend to remove the first one


#3

A post was split to a new topic: Pyglatin 4/11


#4

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