11/11 Code is correct but console returns "empty"


#1

my code:

pyg = 'ay'

original = raw_input('Enter a word:')

if len(original) > 0 and original.isalpha():
    word = original.lower()
    first = word[0]
    new_word = word + first + pyg
    new_word = new_word[1:len(new_word)]
    print new_word
  
else:
    print 'empty'

codeacacademy gave me a green checkmark saying code is correct, but when I enter a word in the console it just returns “empty”


#2

works fine, can i see a screenshot of an attempt where the result is empty?

also, keep in mind that spaces are not alphanumerical, so isalpha seems that as false, so any spaces will in the entered string will result in empty being printed


#3

I’m having the same issue but when I put a capital word in, it returns “empty” instead of returning a lower case pig latin version of the input


#4

edit - I now realize that I was putting a space after the colon in the prompt for input.


#5

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