[Tutor] Begginer in need of help

Julian Martinez del Campo jule_s14 at hotmail.com
Mon Aug 9 06:17:39 CEST 2004

I am brand new to python and am learning python through tutorials on the 
net. i am stuck on one exercise, where i have to write a program that has a 
user guess your name, but they only get 3 chances to do so until the program 
quits. I cannot get my program to quit after the 3 tries. can u help.
(here is my program)

s = 0
a = 1

name = "dan"
while a < 4:
    my_name = raw_input("what is my name? ")
    if my_name == "julian":
        print "correct"
        a = 10
    elif s < 3:
        s = s + a
        print "Nope, you have, ",3-s," tries left"

FREE pop-up blocking with the new MSN Toolbar – get it now! 

More information about the Tutor mailing list