So I’m slowly working through Python 2, I’ve come to the PygLatin component of Conditionals and Control flow. I’ve somehow passed the exercise but I’m confused and not fully comfortable.
When I run the code, my bash will ask me to enter a word twice. I wasn’t sure why it should be asking me twice. I have
raw_input("Enter a word: ") in my coding twice, and was wondering if the second instance is triggering the bash to ask a second time? If so, how can I prevent this? I’m using
raw_input("Enter a word: ") the second time to tie it to the variable ‘original’.
Can anyone shed any light? Code below.
print 'Welcome to the Pig Latin Translator!' # Start coding here! raw_input("Enter a word: ") original = raw_input("Enter a word: ") if len(original) > 0: print original else: print "empty"