Check Yourself!


I'm stuck on PygLating exercise 4: Check Yourself

When I run my code, it gives me an error message saying:
Traceback (most recent call last):
File "python", line 6, in
TypeError: 'str' object is not callable

Here's my code:

print 'Welcome to the Pig Latin Translator!'

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


you need to make your object a string to that it is callable. Therefore, make original equal to something that will make that happen!


The raw_input function works differently. It'll prompt whatever is between the parentheses, and return a string. Now that return you could assign to a variable (original). Check the documentation here.

myVariable = raw_input("Hi! Your favourite color?: ")
#So myVariable, if printed, will show the string you responded with ("red" idk).


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