Broken PygLatin? (11/11)


#1

Even though the code claims to work properly, all I get is ‘empty’. What is the matter?

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’


#2

Does the terminal ask for an input at all or ?

If not, check your input code. I had to change the quotations for it to work


#3

Yes, the terminal does ask for input. When I type something, it just gives me either ‘empty’ or ‘False’ as an answer.


#4

Blockquotepyg = ‘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’

The code tells me that ‘else’ is not in syntax. What is the matter?


#5

Did you indent the right way?


#6

That’s part of the problem. I don’t understand why indent sometimes doesn’t work. I can’t seem to figure it out.


#7

Zenfolio,

I would make sure your indenting is correct and not using a line space for the if else statement. See the below code that runs fine. I noticed in your previous copy of the code you did not update new_word with the renaming of pyg to Blockquotepyg as well and updated it.


#8

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