Check Yourself Some More (Cant Get It)


#1

<I'm on Check Yourself...Some More...

Ive looked at other posts and Ive tried to copy and follow suit, but I still dont know what's exactly wrong.

On the bottom photo it says: "It looks like your code does not print original ("ill") when original is only made up of alphabetical characters."
What does that even mean?
Below are ways ive tried...


#2

First of all, you need to keep

original = raw_input ("Enter a word:")

before your other steps. This way, it shows that you are getting an input first and that Python knows what original is in your if/else statements (this is not javascript. a variable that is going to be used later must be defined beforehand).

Next, your conditional statement is good. It's the print statement afterwords that has an issue.
In your first try, print str(something) is not a proper way of printing a string because Python reads something as a variable (which you never defined anywhere). Just simply type

print("something")
#or
print(original) #where original is your variable input

I'd say your first attempt was the closest to passing this lesson, you just need to change the first print statement.


#3

Thanks @datfatcat

I changed it...but it still reads as an error...
am I using .isalpha() correctly?


#4

The syntax for .isalpha is variable-name.isalpha() so in your case, it's original.isalpha().
Also remove the

raw_input("Enter a word:")
original = raw_input

at the bottom of you code.


#5

Thanks!

I switched in variable correctly and yet it still...


#6

Oh oops, I didn't catch it before! Put a : at the end of your if statement.

if len(original) > 0 and original.isalpha():

#7

aw, i should have caught that as well...

Thank you for helping me with this!


#8

No problem, man. :slight_smile:


#9

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