5/11 Why is isalpha() not working?


#1

Here is my code. The isalpha() check does not work - the code still prints my original word even if the word includes numbers.

I have looked at similar questions from other people on this forum and I just cannot see what is wrong with my code. Help?

(and yes, I remembered the indents - they just don't show up here.)

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


#2

It works for me, try refreshing your webbrowser.


#3

Tried refreshing. Still doing the same thing. The empty check doesn't work either, I just realized. Original still prints.


#4

Remove

print original

before

if blablabla

#5

This seems to have fixed it! Thank you. Why does it carry the code over from previous lessons if they block progress??


#6

They don't block progress, they build up, you'll see that more in the future.

If solved, click solve and like, happy coding! :smile:


#8

could some one add the correct code mine doesnt work at all


#9

This is what I wrote, working good :-). Please indent ( as required )
def if_eng():
word = raw_input("Enter word:\n")
if word.isalpha():
print word[1:] + word[0] + "ay"
else:
print "Enter valid word"
if_eng()
if_eng()


#10

Hi everyone, I'm new to this and I need some help for the next task. Can anybody be kind enough to help?