Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.
Hi, I'm quite a newbie in programming, so this would seem a little lame quesion but I need your help!
So I started learning Python, but I encountered a problem I can't cope with. My task is to "Write a program that has a user guess your name, but they only get 3 chances to do so until the program quits."(hey dont start laughing!
I've written something but I can't make him to work properly:
my_name = "Squirrel"
a = 0
guess = raw_input ("What's my name?")
while a != 3:
if guess == my_name:
print "That's it!"
print "Try again."
a = a + 1
I've tried several ways to do that task but I've always ended up in looping. Could somebody please help me telling what am I doing wrong?
0 · ·