Python lesson PygLatin Check Yourself!


#1



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

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

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 
else:
    print "empty"


#2

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.

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


#3

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


#5

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