.isaplha Check Yourself... Some More


#1

Ok so having fun learning on this lesson.

I was using the following code succesfully and playing a round with it. I have never programmed anything apart from the Toaster.

print 'Welcome to the Pig Latin Translator!'
original = raw_input("Enter a word Pleb")
if len(original) <= 0:
print "Speak you fool"

else: print " salutation " + original

My problems started with trying to tell the program to check for alpha characters. I thought my problem was because i was asking it to check for inputs >0 and aplha so i changed it to this

print 'Welcome to the Pig Latin Translator!'
original = raw_input("Enter a word Pleb")
if len(original) >= 0 and original.isaplha()
print "Salutations " + original

else: print "speak properly fool"

No matter what i do i always get a Syntax error on line 3. My code was working without the .isalpha. I have tried looking at why others were doing with the original.isaplha which is what lead me to do it this way.

can anyone help me or suggested reading. Thanks


#2

if len(original) >= 0 and original.isaplha()

you need a : at the end
also you misspelled isalpha()


#3

I feel like an idiot for misspelling alpha, i put it down to trying so many different versions.

Thanks so much for the colon : my code works great now.

Thanks again


#4

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