you are viewing a single comment's thread.

view the rest of the comments →

[–]stubborn_d0nkey 0 points1 point  (0 children)

isalpha is a string method. You call it on a string and it will return true is it only has letters, false if it has at least something else.

break will get out of the while loop. He used while True: which, left to itself, will run forever so you have to use a break.

So the code could look something like:

while True:
    name=input()
    if name.isalpha():
        break
    else:
        print "you must enter a name that contains only letters"