Don't know if my code is correct


#1

print 'Welcome to the Pig Latin Translator!'

Start coding here!

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

Hey I've already had to restart from the beginning of the lesson once, i restarted it all, but once again I think my code is wrong... i'd like to know what you guys think

When I run the code it doesn't said the word back to me, I have to right it a second time.

Thanks :wink:


#2

That's because "Enter a word:" isn't in raw_input() in original.
Why is it making you write it two times? Because there's a raw_input() function on line one of your code. You have to remove one of them... do you know which one? :wink:


#3

Ooh... Get it now thanks a lot I was stuck for a good 1 hour there... Couldn't figure it out.

I didn't quite get the tip
"On line 4, use raw_input("Enter a word:")
to ask the user to enter a word.
**Save the results of rawinput() in a variable called original**_."


#4

Yeah, sometimes the instructions can be tricky for beginners, but once you get the hang of Python, it starts to get easier because you know what certain things mean and etc...

But yes, you're welcome. :slight_smile: Happy coding! :smile:


#5

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