Hi! Why does my code recognizes and prints a single string (e.g. ‘Panama’), but is unable to recognize separate strings (such as ‘Panama City’) and prints, such case: “Empty”?
Here’s my code so far:
print 'Welcome to the Pig Latin Translator!' # Start coding here! original = raw_input("Enter a word: ") if len(original) > 0 and original.isalpha(): print original else: print "Empty"
pyg = 'ay' #original prompts user to input a random word original = raw_input('Enter a word:') #then checks if it's a valid input: string values only, non-numeric #otherwise, will print as 'empty' if len(original) > 0 and original.isalpha(): word = original.lower() first = word new_word = word + first + pyg new_word = new_word[1:len(new_word)] print new_word else: print 'empty'
Thanks in advance!