Pyg Latin pop quiz question

I’ve passed the Quiz. My code looks fine to me (so it’s probably wrong), but the window prints empty, even when I write with only letters.


name=raw_input("Enter a word:")
if len(original) > 0 and original.isalpha():
    print original
    print "empty"

I entered celery into the window and it printed empty.

Hard to tell what purpose that serves. I think it possible to do away with that line.

Not sure where the variable name came from. It is nowhere in the instructions.

To which raw_input statement did you enter, ‘celery’?

I have to admit I saw “empty_string” on someone’s potential solution to
this lesson. You are right, it is not necessary, I see now that the “If
and” operates in a way that does not need a second definition for an empty
input. Name was used to define my variable. I have since cut the top line
and defined it solely with original. The output is now correct, thank you.
I am finally starting to understand efficiency within coding.

1 Like
Instructions... Innovation... Execution. 

Remember what is at the lead and the rest will follow.

1 Like