How to define if and elif correctly


#1

Hi all,

What I want to check in IF is this:

If the variable original has a length more than 0 and if its letter and numbers then print "You typed letters and numbers".

But it doesnt? I get this message:
Traceback (most recent call last):
File "python", line 6, in
NameError: name 'false' is not defined

My code is like this:

print 'Welcome to the Pig Latin Translator!'

Start coding here!

original = raw_input("Enter a word:"'')

if len(original) > 0 and original.isalpha() == false:
print "You typed letters and numbers",original

elif len(original) > 0 or original.isalpha() == true:
print "you typed letters: ",original

else:
print "empty"

If I write just = instead of == then i get this message:

File "python", line 6
if len(original) > 0 and original.isalpha() = false: ^
SyntaxError: invalid syntax

I am not sure how to write what I had in mind.


#2

The keyword False has to be capitalized.


#3

Hah! So I was not far off. Great thanks! :slightly_smiling: