Having problems with "Check Yourself"


#1



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


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


print 'Welcome to the Pig Latin Translator!'
raw_input("Enter a word:")
original = raw_input

if len(original) > 0:
    print original 

else: 
    print "empty"


I am oblivious as to what I am doing wrong. Someone please try to explain this tio me


#2

What are you trying to do here? You can assign the raw input above to original.


#3

Worked after switching things around. For some reason that worked in the previous section and I thought it was right :stuck_out_tongue:


#4

print 'Welcome to the Pig Latin Translator!'

Start coding here!

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

still i am getting error like

File "python", line 7
else:
^
SyntaxError: invalid syntax


#5

You have an empty print statement.


#6

Try this it works for me, its asking you to store and the prompt
print 'Welcome to the Pig Latin Translator!'

Start coding here!

name = raw_input("What is your name?")
original = raw_input('Prompt')

if len(original) > 0:
print original

else:
print ("Empty")


#7

File "python", line 8
else :
^
SyntaxError: invalid syntax

Now i am getting this dear kindly help


#8

Can you post your new code?


#9

name = raw_input("What is your name?")
original = raw_input('Prompt')

if len(original) > 0:
print original

else:
print ("Empty")


#10

did it work for you? if not could you screenshot it when you try run it


#11

No need for two inputs. Get rid of that name one.
Make sure your indentation is proper like this:

original = raw_input('Prompt')

if len(original) > 0:
    print original

else:
    print ("Empty")

ALSO: no need for the brackets for

print ("Empty")

as it is not needed for python 2.x

EDIT:
Your original prompt was alright. Why did you change it?

original = raw_input("Enter a word:")

#12

Thank you so much dear it's working


#13

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