[Tutor] How to print something just after 3 attempts?

2012-07-17 Thread Santosh Kumar
Hello There, This problem isn't so simple as it looks in the title/subject of this email. I am doing a tutorial on Python, and there is a script named password.py: password = "foobar" while password != "unicorn": password = raw_input("Password: ") print "Welcome in" The question says "Mod

Re: [Tutor] How to print something just after 3 attempts?

2012-07-17 Thread Joel Goldstick
On Tue, Jul 17, 2012 at 11:10 AM, Santosh Kumar wrote: > Hello There, > > This problem isn't so simple as it looks in the title/subject of this email. > > I am doing a tutorial on Python, and there is a script named password.py: > > password = "foobar" > > while password != "unicorn": > passwo

Re: [Tutor] How to print something just after 3 attempts?

2012-07-17 Thread Paul McNally
> Date: Tue, 17 Jul 2012 11:23:07 -0400 > From: joel.goldst...@gmail.com > To: sntshkm...@gmail.com > CC: tutor@python.org > Subject: Re: [Tutor] How to print something just after 3 attempts? > > On Tue, Jul 17, 2012 at 11:10 AM, Santosh Kumar wrote: > > Hello There, > > > > This problem isn't

Re: [Tutor] How to print something just after 3 attempts?

2012-07-17 Thread bob gailer
Simpler solution: for i in range(3): if input("Password: ") == "unicorn": print("Welcome in..") break else: print("That must have been complicated..") -- Bob Gailer 919-636-4239 Chapel Hill NC ___ Tutor maillist - Tutor@python.org To uns

Re: [Tutor] How to print something just after 3 attempts?

2012-07-17 Thread Mark Lawrence
On 17/07/2012 16:28, Paul McNally wrote: Date: Tue, 17 Jul 2012 11:23:07 -0400 From: joel.goldst...@gmail.com To: sntshkm...@gmail.com CC: tutor@python.org Subject: Re: [Tutor] How to print something just after 3 attempts? On Tue, Jul 17, 2012 at 11:10 AM, Santosh Kumar wrote: Hello There,

Re: [Tutor] How to print something just after 3 attempts?

2012-07-17 Thread Brian van den Broek
On 17 Jul 2012 12:39, "Mark Lawrence" wrote: > > On 17/07/2012 16:28, Paul McNally wrote: >> I was able to get it working like this... >> >> password = "foobar" >> attempt = 0 >> while (password != "unicorn") and (attempt <= 3): > > > Please we're talking Python here not C so strip out those un

Re: [Tutor] How to print something just after 3 attempts?

2012-07-17 Thread Mark Lawrence
On 17/07/2012 17:51, Brian van den Broek wrote: On 17 Jul 2012 12:39, "Mark Lawrence" wrote: On 17/07/2012 16:28, Paul McNally wrote: I was able to get it working like this... password = "foobar" attempt = 0 while (password != "unicorn") and (attempt <= 3): Please we're talking Python

Re: [Tutor] How to print something just after 3 attempts?

2012-07-17 Thread Walter Prins
Hi Santosh, On 17 July 2012 16:10, Santosh Kumar wrote: > The question says "Modify the password guessing program to keep track > of how many times the user has entered the password wrong. If it is > more than 3 times, print “That must have been complicated.” FWIW, I interpret the above to mean

[Tutor] Why isn't my simple if elif script not working?

2012-07-17 Thread Santosh Kumar
Here is my script: name = raw_input("What's your name? ") if name == "Santosh": print "Hey!! I have the same name." elif name == "John Cleese" or "Michael Palin": print "I have no preference about your name. Really!!" else: print "You have a nice name." The if part works well. The e

Re: [Tutor] How to print something just after 3 attempts?

2012-07-17 Thread kala Vinay
> > On Tue, Jul 17, 2012 at 11:10 AM, Santosh Kumar > wrote: > > Hello There, > > > > This problem isn't so simple as it looks in the title/subject of this > email. > > > > I am doing a tutorial on Python, and there is a script named password.py: > > > > password = "foobar" > > > > while password

Re: [Tutor] Why isn't my simple if elif script not working?

2012-07-17 Thread Andre' Walker-Loud
Hi Santosh, On Jul 17, 2012, at 10:09 PM, Santosh Kumar wrote: > Here is my script: > > name = raw_input("What's your name? ") > > if name == "Santosh": >print "Hey!! I have the same name." > elif name == "John Cleese" or "Michael Palin": >print "I have no preference about your name. Re

Re: [Tutor] Why isn't my simple if elif script not working?

2012-07-17 Thread Alexandre Zani
On Tue, Jul 17, 2012 at 10:09 PM, Santosh Kumar wrote: > Here is my script: > > name = raw_input("What's your name? ") > > if name == "Santosh": > print "Hey!! I have the same name." > elif name == "John Cleese" or "Michael Palin": > print "I have no preference about your name. Really!!" >

Re: [Tutor] Why isn't my simple if elif script not working?

2012-07-17 Thread Alexandre Zani
On Tue, Jul 17, 2012 at 10:21 PM, Andre' Walker-Loud wrote: > Hi Santosh, > > On Jul 17, 2012, at 10:09 PM, Santosh Kumar wrote: > >> Here is my script: >> >> name = raw_input("What's your name? ") >> >> if name == "Santosh": >>print "Hey!! I have the same name." >> elif name == "John Cleese"

Re: [Tutor] Why isn't my simple if elif script not working?

2012-07-17 Thread Andre' Walker-Loud
> > On Jul 17, 2012, at 10:29 PM, Alexandre Zani wrote: > > > On Tue, Jul 17, 2012 at 10:21 PM, Andre' Walker-Loud > wrote: >> Hi Santosh, >> >> On Jul 17, 2012, at 10:09 PM, Santosh Kumar wrote: >> >>> Here is my script: >>> >>> name = raw_input("What's your name? ") >>> >>> if name == "Sa

Re: [Tutor] Why isn't my simple if elif script not working?

2012-07-17 Thread Ross Wilson
On 18/07/12 15:09, Santosh Kumar wrote: Here is my script: name = raw_input("What's your name? ") if name == "Santosh": print "Hey!! I have the same name." elif name == "John Cleese" or "Michael Palin": print "I have no preference about your name. Really!!" else: print "You hav