Python 5/11 Exercise


#1

print 'Welcome to the Pig Latin Translator!'

Start coding here!

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

This is my code an this is my error message:
Oops, try again. It looks like your code does not print original ("hi") when original is only made up of alphabetical characters.

Please help cause i am clueless because it looks right (i think)


#2

Hi daniaalndalr!

You don't need any of the top 2 lines. Your code should look like this

original = raw_input("Enter a word")

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

make sure to indent your code too.


#3

Thanks a lot. In the instructions it says to add raw_input so god knows. Again, thanks a thousand <3


#4

I'm using the foolowing code but the console is giving me an error:

Welcome to the Pig Latin Translator!

Traceback (most recent call last):

File "python", line 3, in

TypeError: 'str' object is not callable

original = raw_input("Enter a word")

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