Check yourself...some more


#1

The link to the Exercise i am stuck on: https://www.codecademy.com/en/courses/python-beginner-2W5v7/0/5?curriculum_id=4f89dab3d788890003000096


The error messages are "Traceback (most recent call last):
File "python", line 4, in
TypeError: 'str' object is not callable"

this is the instructions for what i want to happen:Use and to add a second condition to your if statement. In addition to your existing check that the string contains characters, you should also use .isalpha() to make sure that it only contains letters.

my code below, if anyone could tell me what needs editing and tell me why would be massively appreciated

print 'Welcome to the Pig Latin Translator!'

# Start coding here!
raw_input("what's your name?")
original = raw_input

raw_input = ""
if len(original) > 0 and original.isalpha():
    "Run this block"
else:
    "string must be empty"

#2

The first value you are taking from the user should be store to the variable named original
it would be like

original= raw_input("Enter a word:")

so you can't do like

raw_input("what's your name?")
original = raw_input  // wrong

remove this too

raw_input = ""

raw_input is not a variable.its Built-in Functions in python 2
here is the link

and

if len(original) > 0 and original.isalpha():
    "Run this block"
else:
    "string must be empty"

here "Run this block" is just a string expression nothing else .if you want to print the string then you should use

print keyword

same for the else statement


#3

thank you now have a working code :slight_smile:

print 'Welcome to the Pig Latin Translator!'

Start coding here!

original = raw_input

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


#4

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