6.4 PygLatin NameError: name 'original' is not defined "Why is this the case?"


#1



Replace this line with your code.


#2

print 'Welcome to the Pig Latin Translator!'

Start coding here!

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

if len(orignial) > 0:
print (original)
else:
print "empty"

This is the code btw


#3

Hey there @whiskeymyers

The issue with your code is that you try to set the original to a random raw_input() that doesn't exist . Simply change your code to the following:

print ("Welcome to the Pig Latin Translator")

original = raw_input("Enter a word: ")

if len(original) > 0:
     print(original)
else:
     print "empty"

This will set the variable original to the result of the raw_input() . Hope this helps.


#4

It's still giving me the same "NameError", telling me that 'original' is not defined.


#5

@whiskeymyers

This is weird... Can you post your code after it was updated or try refreshing webpage sometimes it helps.


#6

You really should be doing this:

print 'Welcome to the Pig Latin Translator!'

# Start coding here!
original = ""

if len(original) > 0:
    print "You typed a word"
    
else:
    print "empty"

I hope this helps! :smile:


#7

HI!
I think the main reason is you got a typo in

.


#8

That's what it was. Thank you!