Python lesson PygLatin Check Yourself!


I am having a hard time figuring out what is wrong?

Traceback (most recent call last):
File "python", line 6, in
TypeError: object of type 'builtin_function_or_method' has no len()

Replace this line with your code. 
print 'Welcome to the Pig Latin Translator!'

# Start coding here!
raw_input("Please enter a word?")
original = raw_input 
if len(original) > 0: 
    print original 
    print "empty"


Hello @mastercoder500000,

I think you got confused over raw_input() function.
This function is used to take input from users.

As it's important to show message to user what he/she have to enter so we can do this two way... either use print or directly put message to raw_input. (Tho it's(message) optional)
The work of raw_input is to prompt the user for a input, we can capture that input inside a variable using assignment operator ( =)

Lets take an example..

print "Enter a number: "
number = raw_input()

Or we can directly pass the string to our raw_input function like this..

number = raw_input("Enter a number: ")

When this line runs.. You will see a prompt, whatever you give as input will be saved ,as we're saving it to number here.

In this exercise You have to save your raw_inputs value to original variable.


Thanks for that I was having a hard time figuring that out and the glossary was no help at all.


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