Pyg Latin


#1



Pyg Latin
https://www.codecademy.com/courses/python-beginner-2W5v7/1/2?curriculum_id=4f89dab3d788890003000096

Everytime I try to submit the code it gives me an error telling me to make sure I made a variable called 'word' when i clearly did make a variable named word


pyg = 'ay'

original = raw_input('Enter a word:')

if len(original) > 0 and original.isalpha() and word = original.lower() and first = "word"[0]:
    print original
else:
    print 'empty'


#2

You cannot assign a variable when inside the condition of an if-statement. You should move the assignments to before the if-statement, then reevaluate.


#3

word == is the problem


#4

That would create an error that word is not defined.


#5

Oops, try again. It looks like you printed the correct translation of "hien", but make sure to set new_word equal to the slice as well.


#6

the instructions told me to put everything inside the if statement


#7

in my code i do not see what you see. i don't see a word == just word =
where is it?


#8

Inside the if-statement means:

if True:
   <Inside here>

#9

I think that's a step forward but i still get an error like this
with this code
pyg = 'ay'

original = raw_input('Enter a word:')

if len(original) > 0 and original.isalpha() .lower():
word = original.lower()
first = word[0]
print original
else:
print 'empty'

Traceback (most recent call last):
File "python", line 5, in
AttributeError: 'bool' object has no attribute 'lower'


#10

while still getting the other error saying did i even make the variable word


#11

nevermind i fied it i left .lower() in the if statement woops


#12

original.isalpha() is a method that looks at a string (original) and checks to make sure that it only has letters in the string. (no numbers or symbols) It returns True or False accordingly.
.lower() takes a string and makes it all lowercase, however, since it comes after .isalpha(), it is not getting a string, but a boolean. which it cannot comprehend.


#13

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