Stuck InPython: 3- Conditionals and control flow. PygLatin Part 1. 5.-Check yourself... Some more


#1

I can only post one picture so im posting the error.
Here is the link to the excercise so you can see it
https://www.codecademy.com/courses/python-beginner-2W5v7/0/5?curriculum_id=4f89dab3d788890003000096


Apparently the function ".isalpha()" "has no attribute".


I expected the excercise to be done and correct.

Here is the error

Below is my code

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"


#2

Well you are missing a very important statement between your original = raw_input and your if statement. It has to do with the original as well. If you need more of a hint just respond back as so


#3

Do i need to define that original contains charachters with has_chars() function?
Or am i missing something else
ty btw


#4

Not quite. You are not checking the characters but of word but making sure that the word you type into the raw input will be put on the screen and then processed. Might not be the best explanation but it should lead you into the right direction. Basically, you need original to equal something else that will help that to happen.


#5

i just changed the line 6
added () at the end of raw_input
IT WORKED


#6

Huh. Missed that good find! :smiley:


#7

@dchurchw , if after making that change, you now have this as part of your code ...

raw_input("Enter a word:")

original = raw_input()

... you should consider making an additional revision to your code. With the above statements, notice how many times you need to hit the enter (return) key when you run the program.


#8

hmm, two.
it seems like teh first time i press enter, the text in tehre doesnt matter, the second one is the one that makes teh program print its value, or empty


#9

Yes.

Do you understand why that happens? What could be done to correct that?

See the documentation at Python 2: raw_input.


#10

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