Word up


#1

this is my code for lesson 8 pyglatin word up

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:

it keeps telling me

Oops, try again. Did you create a variable called word?

and giving me this error

File "python", line 5
    if len(original) > 0 and original.isalpha() and word=original.lower and first=word[0]:
                                                        ^
SyntaxError: invalid syntax

what am I doing wrong

`


Word up
#2

That can all be removed. It is not asked for.


#3

The interpreter is pointing you to the error here

Remember the if block expects a boolean value as parameter. You cannot perform an assignment operation there


#4

What is it supposed to look like IV tried writing it 5 different ways and something doesn't work


#5

Simply change from

= #means assignment

to

== #comparison

#6

can some one show me how the code is supposed to look like


#7

Let's go back to lesson 4 where we introduce the first check...

print "Welcome to the English to Pig Latin translator!"
original = raw_input('Prompt')
if len(original) > 0:
    print original
else:
    print "empty"

In the above, we are checking that the user hasn't just clicked okay with no input (an empty value). If at least one letter is entered, the length will be greater than 0.

Lesson 5 introduces a second check, that the input is letters, and not numbers or non-word characters. We are instructed to AND this test to the one we have already.

rint "Welcome to the English Pig Latin translator!"
original = raw_input('Prompt')

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

This is the code we carry into lesson 6, where we are given an opportunity to test it. There are no further instructions to add more code or conditions.


#9

The instructions are to create two new variables, including "word" and "first." So I would ask as a follow-up, where are these new items included in the code?


#10

Once we validate original,

    print original
    word = original.lower()
    first = word[0]