Pop Quiz problem


#1


I'm a little confused with this exercise.

  1. In the console i have to type in two words, or submit a blank entry into the console to get a reply. (so i type in the first after 'enter a word', and then, before i can proceed, i have to type another word on the line below) i'm not sure if this is correct

  2. if i type in two different words, even if they are both legitimate, i get the error 'It looks like your code does not print original ("anything") when original is only made up of alphabetical characters'

  3. Any numbers and the console returns 'empty', which is what I'm looking for right ?

if so:

  1. What is the console supposed to look like when the code runs correctly when typing in a legitimate entry ?

When an entry goes through correctly, i.e. a couple of numbers returns 'empty' & 'none' i get the congratulations message and i could go on to the next exercise. But this code has problems soon as its tested.

any help with some explanation would be greatly appreciated


https://www.codecademy.com/en/courses/python-beginner-2W5v7/0/6?curriculum_id=4f89dab3d788890003000096


print 'Welcome to the Pig Latin Translator!'

# Start coding here!
raw_input("Enter a word:")
original = raw_input()

empty_string = ""
x = "J123"

if len(original) > 0 and original.isalpha(): 
    print "word up, games gonna begin"
    
else: 
    print "empty"


#3

1.
you should combine this lines:

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

you have two raw_inputs (prompts), combine them so the result is stored in original:

original = raw_input("Enter a word:")
  1. Yep, numbers should print empty, so that is good. Invalid might be better to print, but that might not work in the exercise, you can change it later if you want

  2. you should print original:

    print original

#4

Also here.

Those two lines were just examples of using the .isalpha() function. Don't copy/paste codecademy examples in your code or you'll accumulate a lot of bugs when running your final code.


#5

thanks for the quick replies ! i changed the code to this:
print 'Welcome to the Pig Latin Translator!'

Start coding here!

original = raw_input("Enter a word:")

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

else:
print "invalid"

only now i get the message "It looks like your code does not print original ("example") when original is only made up of alphabetical characters "


#6

@textmaster96582 ,

You have this ...

print "original"

Because you used quotes, you are printing the string, "original" instead of the value of the variable, original .


#7

original shouldn't have quotation marks ", since original is a variable, not a string.


#8

Your final print statement should print "empty" not "invalid" .


#9

thanks for the help !