[Tutor] While loop homework: was Re: Tutor Digest, Vol 161, Issue 33

2017-07-30 Thread Alan Gauld via Tutor
On 30/07/17 23:36, Borisco Bizaro wrote: > a=1 > b=2 > while a input ("enter another price :") Do 'a' or 'b' ever change? Does 'a print"\n\n press 0 key to stop" Does the user ever get the chance to enter a value? If they were, Where is the value stored and is the value ever used? >> When rep

Re: [Tutor] While Loop Question

2017-05-11 Thread George Fischhof
2017-05-11 3:53 GMT+02:00 Rafael Skovron : > Sorry I left out the indents in my previous email. It seems like j is > always reset to zero. Why does j vary? > > Are there two different instances of j going on? > > > for i in range(1, 5): > > j=0 > >while j < i: > > print(j, end = "

Re: [Tutor] While Loop Question

2017-05-11 Thread Steven D'Aprano
On Wed, May 10, 2017 at 06:53:21PM -0700, Rafael Skovron wrote: > Sorry I left out the indents in my previous email. It seems like j is > always reset to zero. Why does j vary? Because you run code that adds 1 to j. > Are there two different instances of j going on? No. Try to run the code in y

[Tutor] While Loop Question

2017-05-11 Thread Rafael Skovron
Sorry I left out the indents in my previous email. It seems like j is always reset to zero. Why does j vary? Are there two different instances of j going on? for i in range(1, 5): j=0 while j < i: print(j, end = " ") j += 1 ___

Re: [Tutor] While Loop Help

2014-12-11 Thread James Chapman
While Alan has given you a far better solution, I feel someone should mention the break statement as you will likely come across it a lot, and it is quite an important flow control statement. You could add a break statement to the else which would break out of the while loop. https://docs.python.o

Re: [Tutor] While Loop Help

2014-12-11 Thread Steven D'Aprano
On Wed, Dec 10, 2014 at 11:20:12PM -0500, Matthew Nappi wrote: > I am working on the challenges from “Python Programming for the Absolute > Beginner” Chapter 3. I am asked to modify the original code pasted below > to limit the number of guesses a player has to guess the number. I did so > (code

Re: [Tutor] While Loop Help

2014-12-11 Thread Alan Gauld
On 11/12/14 04:20, Matthew Nappi wrote: (code pasted below); however if a player guesses the right number they still receive an ending message indicating that they failed. How can I modify the code without using any advanced techniques to have a different message in the event of a successful gu

[Tutor] While Loop Help

2014-12-11 Thread Matthew Nappi
Hello All: I am working on the challenges from “Python Programming for the Absolute Beginner” Chapter 3. I am asked to modify the original code pasted below to limit the number of guesses a player has to guess the number. I did so (code pasted below); however if a player guesses the right numb

Re: [Tutor] While Loop and Threads

2014-07-15 Thread Japhy Bartlett
this construct: On Tue, Jul 15, 2014 at 5:09 AM, Oğuzhan Öğreden wrote: > > > while time_now < time_finish: # counter and count_until defined > somewhere above and > if g_threadStop.is_set() == False: > # return something or raise an exception to signal > ite

Re: [Tutor] While Loop and Threads

2014-07-15 Thread James Chapman
Apologies, I didn't answer your question. while time_now < time_finish: # counter and count_until defined somewhere above and if g_threadStop.is_set() == False: # return something Thread methods are typically void, meaning they return nothing. At least this is

Re: [Tutor] While Loop and Threads

2014-07-15 Thread James Chapman
So if I understand this correctly, you want to start a thread and then stop it after a certain time period? Here's an adapted example that includes a timer. (I believe in learning by example where possible) With that said, if it were my code going into production I'd move the timer logic out of th

Re: [Tutor] While Loop and Threads

2014-07-15 Thread Oğuzhan Öğreden
Thanks! I'll have a side question. If I implement this idea to my case, threadWorker() would look like this: def threadWorker(_arg1, _arg2): print("Starting worker thread with args: %s, %s" % (_arg1, _arg2)) while g_threadStop.is_set() == False: ## here comes a for loop:

Re: [Tutor] While Loop and Threads

2014-07-14 Thread James Chapman
OK, so I mocked up an example now... import time import threading g_threadStop = threading.Event() def threadWorker(_arg1, _arg2): print("Starting worker thread with args: %s, %s" % (_arg1, _arg2)) while(not g_threadStop.is_set()): print("Thread running.") time.sleep(1)

Re: [Tutor] While Loop and Threads

2014-07-14 Thread James Chapman
Multi-threading takes practice! Are you using an event object to signal the thread should exit? I'm guessing you're just using a bool which is why it does not work. See: https://docs.python.org/3.4/library/threading.html#event-objects I'm very short on time and the moment and therefore can't moc

[Tutor] While Loop and Threads

2014-07-13 Thread Oğuzhan Öğreden
Hi, I've been practicing with multithreading and gtk for a while and recently have observed something I can't quite grasp. This is basically a timer with a settings window and a countdown window which is produced after setting_window passes necessary arguments to thread. I have a while loop whic

Re: [Tutor] While loop issue, variable not equal to var or var

2014-07-12 Thread Steven D'Aprano
On Sat, Jul 12, 2014 at 02:39:12PM +0200, Wolfgang Maier wrote: [...] > Very interesting advice. Wasn't aware at all of this feature of casefold. > As a native German speaker, I have to say that your last two examples > involving the capital ß are pretty contrived: although the capital ß is > par

Re: [Tutor] While loop issue, variable not equal to var or var

2014-07-12 Thread Alan Gauld
On 12/07/14 13:19, Steven D'Aprano wrote: Because the person might have typed any of: grosse große etc., and you want to accept them all, just like in English The bit I was missing was that a German user might use the ss version instead the ß so testing for either of them alone is insuffi

Re: [Tutor] While loop issue, variable not equal to var or var

2014-07-12 Thread Wolfgang Maier
On 12.07.2014 14:20, Dave Angel wrote: I don't remember my high school German enough to remember if the ß character is an example, but in various languages there are characters that exist only in uppercase, and whose lowercase equivalent is multiple letters. Or vice versa. And characters

Re: [Tutor] While loop issue, variable not equal to var or var

2014-07-12 Thread Wolfgang Maier
On 12.07.2014 14:19, Steven D'Aprano wrote: On Sat, Jul 12, 2014 at 11:27:17AM +0100, Alan Gauld wrote: On 12/07/14 10:28, Steven D'Aprano wrote: If you're using Python 3.3 or higher, it is better to use message.casefold rather than lower. For English, there's no real difference: ... but it ca

Re: [Tutor] While loop issue, variable not equal to var or var

2014-07-12 Thread Steve Rodriguez
Thank you guys! Works perfectly! :D Regards, Steve Rodriguez On Sat, Jul 12, 2014 at 1:21 AM, Peter Otten <__pete...@web.de> wrote: > Peter Otten wrote: > > > PS: You sometimes see > > > > message in "qQ" > > > > but this is buggy as it is true when the message is either > > "q", "Q", or "qQ".

Re: [Tutor] While loop issue, variable not equal to var or var

2014-07-12 Thread Joseph Lee
Hi Steve, In your conditionals: … while message != 'q' or 'Q'/message != “q” or message != “Q”: … Python will only match the first variable. A better approach (which might be a good solution) would be capturing the exit commands in a list like this: JL’s code: while message not in [“q”, “Q”]

Re: [Tutor] While loop issue, variable not equal to var or var

2014-07-12 Thread Dave Angel
Steven D'Aprano Wrote in message: > On Sat, Jul 12, 2014 at 09:33:20AM +0100, Alan Gauld wrote: > >> 2) Better (IMHO) is to convert message to lower case (or upper if >> you prefer) and only do one comparison: >> >> while message.lower() != 'q': > > I second this advice, but with a slight modif

Re: [Tutor] While loop issue, variable not equal to var or var

2014-07-12 Thread Steven D'Aprano
On Sat, Jul 12, 2014 at 11:27:17AM +0100, Alan Gauld wrote: > On 12/07/14 10:28, Steven D'Aprano wrote: > > >If you're using Python 3.3 or higher, it is better to use > >message.casefold rather than lower. For English, there's no real > >difference: > >... > >but it can make a difference for non-E

Re: [Tutor] While loop issue, variable not equal to var or var

2014-07-12 Thread Alan Gauld
On 12/07/14 10:28, Steven D'Aprano wrote: If you're using Python 3.3 or higher, it is better to use message.casefold rather than lower. For English, there's no real difference: ... but it can make a difference for non-English languages: py> "Große".lower() # German for "great" or "large" 'groß

Re: [Tutor] While loop issue, variable not equal to var or var

2014-07-12 Thread Steven D'Aprano
On Sat, Jul 12, 2014 at 09:33:20AM +0100, Alan Gauld wrote: > 2) Better (IMHO) is to convert message to lower case (or upper if > you prefer) and only do one comparison: > > while message.lower() != 'q': I second this advice, but with a slight modification. If you're using Python 3.3 or higher,

Re: [Tutor] While loop issue, variable not equal to var or var

2014-07-12 Thread Alan Gauld
On 11/07/14 22:16, Steve Rodriguez wrote: Hey guys n gals, New to python, having some problems with while loops, I would like to make a program quick once q or Q is typed, but thus far I can only get the first variable to be recognized. > My code looks like: > > message = raw_input("-> ")

Re: [Tutor] While loop issue, variable not equal to var or var

2014-07-12 Thread Peter Otten
Peter Otten wrote: > PS: You sometimes see > > message in "qQ" > > but this is buggy as it is true when the message is either > "q", "Q", or "qQ". Oops, I forgot "". ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription option

Re: [Tutor] While loop issue, variable not equal to var or var

2014-07-12 Thread Peter Otten
Steve Rodriguez wrote: > Hey guys n gals, > > New to python, having some problems with while loops, I would like to make > a program quick once q or Q is typed, but thus far I can only get the > first variable to be recognized. My code looks like: > > message = raw_input("-> ") > while m

[Tutor] While loop issue, variable not equal to var or var

2014-07-11 Thread Steve Rodriguez
Hey guys n gals, New to python, having some problems with while loops, I would like to make a program quick once q or Q is typed, but thus far I can only get the first variable to be recognized. My code looks like: message = raw_input("-> ") while message != 'q': s.send(message)

Re: [Tutor] While Loop?

2014-05-19 Thread Alan Gauld
On 18/05/14 23:44, Sam Ball wrote: I however would like to add in another line that tells the user their account is invalid before looping around and asking them to re enter their account. OK, Time to introdusce another Pyhon idioM, the break clause. while True: # loop forever get inpu

Re: [Tutor] While Loop?

2014-05-18 Thread Sam Ball
---- > Date: Wed, 14 May 2014 16:16:45 -0400 > From: d...@davea.name > To: tutor@python.org > Subject: Re: [Tutor] While Loop? > > On 05/14/2014 05:45 AM, Sam Ball wrote: >> I'm attempting to create a program where the user inputs

Re: [Tutor] While Loop?

2014-05-14 Thread Dave Angel
On 05/14/2014 05:45 AM, Sam Ball wrote: I'm attempting to create a program where the user inputs their account number (which must be 8 digits) and if what the user enters is not 8 digits in length I want python to tell the user this is invalid and then keep asking for the account number until

Re: [Tutor] While Loop?

2014-05-14 Thread Danny Yoo
On Wed, May 14, 2014 at 2:45 AM, Sam Ball wrote: > I'm attempting to create a program where the user inputs their account > number (which must be 8 digits) and if what the user enters is not 8 digits > in length I want python to tell the user this is invalid and then keep > asking for the account

Re: [Tutor] While Loop?

2014-05-14 Thread Alan Gauld
On 14/05/14 10:45, Sam Ball wrote: I'm attempting to create a program where the user inputs their account number (which must be 8 digits) and if what the user enters is not 8 digits in length I want python to tell the user this is invalid and then keep asking for the account number until a suitab

[Tutor] While Loop?

2014-05-14 Thread Sam Ball
I'm attempting to create a program where the user inputs their account number (which must be 8 digits) and if what the user enters is not 8 digits in length I want python to tell the user this is invalid and then keep asking for the account number until a suitable number has been entered. I'm g

Re: [Tutor] while loop

2014-04-01 Thread Alan Gauld
On 01/04/14 00:22, Scott Dunning wrote: def print_n(s,n): i = 0 while i < n: print s, i += 1 print_n('a',3) Also, with this exercise it’s using a doctest so I don’t actually call the function I have no idea what you mean buy this? There is no doctest above and yo

Re: [Tutor] while loop

2014-04-01 Thread Dave Angel
Scott Dunning Wrote in message: > > On Mar 31, 2014, at 5:15 AM, Dave Angel wrote: >> >> Do you know how to define and initialize a second local variable? >> Create one called i, with a value zero. >> >> You test expression will not have a literal, but compare the two >> locals. And the st

Re: [Tutor] while loop

2014-04-01 Thread Scott Dunning
On Mar 31, 2014, at 5:15 AM, Dave Angel wrote: > > Do you know how to define and initialize a second local variable? > Create one called i, with a value zero. > > You test expression will not have a literal, but compare the two > locals. And the statement that increments will change i, not

Re: [Tutor] while loop

2014-03-31 Thread Scott Dunning
On Mar 31, 2014, at 1:39 AM, Mark Lawrence wrote: > > They say that the truth hurts, so if that's the best you can come up with, I > suggest you give up programming :( You’re in the TUTOR section. People in here are new to programming. I’ve only been doing this for a couple months and I just

Re: [Tutor] while loop

2014-03-31 Thread Scott Dunning
On Mar 31, 2014, at 2:01 AM, Alan Gauld wrote: > > Incidentally, your assignment does not appear to require > a while loop, just iteration? If thats the case you could > use a for loop instead and it would actually be more > suitable. Have you covered for loops yet? > No, we haven’t got to fo

Re: [Tutor] while loop

2014-03-31 Thread David Rock
* Scott Dunning [2014-03-30 18:37]: > Without out a break or placing that 10 in there I can’t think of a way > to have the while loop stop once it reaches (n). Any hints? As discussed already, you can't use fixed values (ie, you don't know that 10 is always going to be there). > def print_n(s

Re: [Tutor] while loop

2014-03-31 Thread Dave Angel
Scott Dunning Wrote in message: > > On Mar 30, 2014, at 4:29 AM, Dave Angel wrote: >> >> You're getting closer. Remember that the assignment shows your >> function being called with 10, not zero. So you should have a >> separate local variable, probably called I, which starts at >> zero, a

Re: [Tutor] while loop

2014-03-31 Thread Alan Gauld
On 31/03/14 03:13, Scott Dunning wrote: separate local variable, probably called I, which starts at zero, and gets incremented each time. The test in the while should be comparing them. So, this is what I have now and it ‘works’ It doesn't work because they are all on the same line. But al

Re: [Tutor] while loop

2014-03-31 Thread Alan Gauld
On 31/03/14 02:37, Scott Dunning wrote: You're getting closer. Remember that the assignment shows your function being called with 10, not zero. So you should have a separate local variable, probably called I, which starts at zero, and gets incremented each time. Without out a break or pla

Re: [Tutor] while loop

2014-03-31 Thread Mark Lawrence
On 31/03/2014 03:13, Scott Dunning wrote: On Mar 30, 2014, at 4:29 AM, Dave Angel wrote: You're getting closer. Remember that the assignment shows your function being called with 10, not zero. So you should have a separate local variable, probably called I, which starts at zero, and gets

Re: [Tutor] while loop

2014-03-31 Thread Scott Dunning
On Mar 30, 2014, at 4:29 AM, Dave Angel wrote: > > You're getting closer. Remember that the assignment shows your > function being called with 10, not zero. So you should have a > separate local variable, probably called I, which starts at > zero, and gets incremented each time. > > The te

Re: [Tutor] while loop

2014-03-31 Thread Scott Dunning
On Mar 30, 2014, at 4:29 AM, Dave Angel wrote: > > > You're getting closer. Remember that the assignment shows your > function being called with 10, not zero. So you should have a > separate local variable, probably called I, which starts at > zero, and gets incremented each time. The exer

Re: [Tutor] while loop

2014-03-30 Thread Dave Angel
Scott Dunning Wrote in message: > > On Mar 29, 2014, at 12:47 AM, Dave Angel wrote: >> >> So did your code print the string 10 times? When asking for help, >> it's useful to show what you tried, and what was expected, and >> what actually resulted. >> >> You use * to replicate the string,

Re: [Tutor] while loop

2014-03-30 Thread Alan Gauld
On 30/03/14 02:36, Scott Dunning wrote: Your while loop doesn't quit after 10 times, it keeps going. Can you figure out why? This works without a break. > Is this more a long the line of what the excercise was > looking for you think? Yes. while n <= 10: print s n =

Re: [Tutor] while loop

2014-03-30 Thread Scott Dunning
On Mar 29, 2014, at 12:47 AM, Dave Angel wrote: > > So did your code print the string 10 times? When asking for help, > it's useful to show what you tried, and what was expected, and > what actually resulted. > > You use * to replicate the string, but that wasn't what the > assignment aske

Re: [Tutor] while loop

2014-03-30 Thread Scott Dunning
On Mar 29, 2014, at 12:47 AM, Dave Angel wrote: > > What are you uncertain about, assert or isinstance? Such > statements are frequently used to make sure the function > arguments are of the right type. I’m not sure exactly what it’s doing. I guess I need to read up on it again. > >> >> >

Re: [Tutor] while loop

2014-03-30 Thread Scott Dunning
On Mar 28, 2014, at 10:36 PM, Ben Finney wrote: > > A good programming exercise will show an example input and the expected > output, to give an unambiguous test case. Does the homework have that? This is what the exercise has as examples… """Print the string `s`, `n` times. Parameter

Re: [Tutor] while loop

2014-03-29 Thread Dave Angel
Scott W Dunning Wrote in message: > > On Mar 28, 2014, at 9:54 PM, Scott W Dunning wrote: > >> Hello, I’m working on some practice exercises from my homework and I’m >> having some issues figuring out what is wanted. >> >> We’re working with the while loop and this is what the questi

Re: [Tutor] while loop

2014-03-28 Thread Jay Lozier
On 03/29/2014 01:18 AM, Scott W Dunning wrote: On Mar 28, 2014, at 9:54 PM, Scott W Dunning wrote: Hello, I’m working on some practice exercises from my homework and I’m having some issues figuring out what is wanted. We’re working with the while loop and this is what the question states;

[Tutor] while loop

2014-03-28 Thread Scott W Dunning
Hello, I’m working on some practice exercises from my homework and I’m having some issues figuring out what is wanted. We’re working with the while loop and this is what the question states; Write a function print_n that prints a string n times using iteration. """Print the string `s`

Re: [Tutor] while loop

2014-03-28 Thread Ben Finney
Scott W Dunning writes: > On Mar 28, 2014, at 9:54 PM, Scott W Dunning wrote: > > > We’re working with the while loop and this is what the question states; > > > > Write a function print_n that prints a string n times using iteration. > This is what I have so far but I’m not really sure it’s wh

Re: [Tutor] while loop

2014-03-28 Thread Scott W Dunning
On Mar 28, 2014, at 9:54 PM, Scott W Dunning wrote: > Hello, I’m working on some practice exercises from my homework and I’m having > some issues figuring out what is wanted. > > We’re working with the while loop and this is what the question states; > > Write a function print_n that prints

Re: [Tutor] While loop

2013-04-06 Thread Sayan Chatterjee
# skip 5 if count == 5: continue # means "Jump back to the top of the looop" It is the reason. You yourself have mentioned it right inside the code! On 7 April 2013 09:40, Dave Angel wrote: > On 04/06/2013 11:23 PM, Najam Us Saqib wrote: > >> Hi, >> >> Would you please help me by e

Re: [Tutor] While loop

2013-04-06 Thread Dave Angel
On 04/06/2013 11:23 PM, Najam Us Saqib wrote: Hi, Would you please help me by explaining that why " 5 " is skipped and not printed in the following program? Seems to me the comments say it pretty well. The continue statement causes execution to continue at the while statement, which has th

Re: [Tutor] While loop

2013-04-06 Thread Dave Angel
On 04/06/2013 11:23 PM, Najam Us Saqib wrote: Hi, Would you please help me by explaining that why " 5 " is skipped and not printed in the following program? Seems to me the comments say it pretty well. The continue statement causes execution to continue at the while statement, which has th

[Tutor] While loop

2013-04-06 Thread Najam Us Saqib
Hi, Would you please help me by explaining that why " 5 " is skipped and not printed in the following program? Thank you. Najam. count = 0 while True:     count += 1     # end loop if count is greater than 10     if count > 10:         break # means "break out of the loop"     # skip 5     if c

Re: [Tutor] While Loop

2012-06-12 Thread Dave Angel
On 06/13/2012 01:29 AM, Andrew Brunn wrote: > Let me preface by saying that I am currently taking my first programming > class; so I have been a "programmer" for just over a week now. > > Here is my question; > > I > am trying to create a while loop that will allow me ask for a username > and pa

[Tutor] While Loop

2012-06-12 Thread Andrew Brunn
Let me preface by saying that I am currently taking my first programming class; so I have been a "programmer" for just over a week now. Here is my question; I am trying to create a while loop that will allow me ask for a username and password.  If a wrong username and password is entered, I wo

Re: [Tutor] while loop ends prematurly

2012-01-02 Thread Walter Prins
Hi again, On 2 January 2012 06:28, Steven D'Aprano wrote: >> Another answer is to use Decimal class, which CAN represent decimal values >> exactly. > > > That only applies to decimal values which can be represented using a fixed > number of decimal places. So 1/5 is fine, and is 0.2 exactly, but

Re: [Tutor] while loop ends prematurly

2012-01-02 Thread Dave Angel
(You accidentally forgot to include the list when you replied. The easiest way (for most people) to avoid that is to use Reply-all) On 01/02/2012 01:00 AM, Sarma Tangirala wrote: On 2 Jan 2012 08:56, "Dave Angel" wrote: Easiest answer is to use integers. Scale everything up by a factor of

Re: [Tutor] while loop ends prematurly

2012-01-02 Thread Walter Prins
Hi Steven, On 2 January 2012 06:28, Steven D'Aprano wrote: > That only applies to decimal values which can be represented using a fixed > number of decimal places. So 1/5 is fine, and is 0.2 exactly, but 1/3 is > not, since it would require an infinite number of decimal places. Just a small nit

Re: [Tutor] while loop ends prematurly

2012-01-01 Thread Steven D'Aprano
Dave Angel wrote: Easiest answer is to use integers. Scale everything up by a factor of 100, and you won't need floats at all. Just convert when printing (and even then you may get into trouble). Another answer is to use Decimal class, which CAN represent decimal values exactly. That onl

Re: [Tutor] while loop ends prematurly

2012-01-01 Thread Hugo Arts
On Mon, Jan 2, 2012 at 3:48 AM, brian arb wrote: > Hello, > Can some please explain this to me? > My while loop should continue while "owed" is greater than or equal to "d" > > first time the function is called > the loop exits as expected > False: 0.00 >= 0.01 > the next time it does not

Re: [Tutor] while loop ends prematurly

2012-01-01 Thread Dave Angel
On 01/01/2012 09:48 PM, brian arb wrote: Hello, Can some please explain this to me? My while loop should continue while "owed" is greater than or equal to "d" first time the function is called the loop exits as expected False: 0.00>= 0.01 the next time it does not False: 0.01>= 0.010

[Tutor] while loop ends prematurly

2012-01-01 Thread brian arb
Hello, Can some please explain this to me? My while loop should continue while "owed" is greater than or equal to "d" first time the function is called the loop exits as expected False: 0.00 >= 0.01 the next time it does not False: 0.01 >= 0.01 Below is the snippet of code, and th

Re: [Tutor] while loop problem

2009-03-08 Thread Lie Ryan
mustafa akkoc wrote: hello i have syntax problem in this program After correcting the indentations, and putting a missing parentheses in line 24 (the last line), I don't see any Syntax Error. #!/usr/bin/python # Filename: while.py number = 23 running = True while running : guess= i

Re: [Tutor] while loop problem

2009-03-08 Thread Alan Gauld
"mustafa akkoc" wrote hello i have syntax problem in this program #!/usr/bin/python # Filename: while.py number = 23 running = True while running : guess= input('Enter an integer : ') # it give a syntax error this line can you me ? Always post the full text of error messages please. It h

[Tutor] while loop problem

2009-03-08 Thread mustafa akkoc
hello i have syntax problem in this program #!/usr/bin/python # Filename: while.py number = 23 running = True while running : guess= input('Enter an integer : ') # it give a syntax error this line can you me ? if guess == number: print('Congratulations, you guessed it.') running = False # this c

Re: [Tutor] While loop counter

2008-07-07 Thread David
Thank you John & Allen, See the loops section of my tutorial for more about for and while loops. Yes, great tutorial, just getting it to sink in, now thats the problem :) ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/

Re: [Tutor] While loop counter

2008-07-07 Thread Alan Gauld
"David" <[EMAIL PROTECTED]> wrote Hi, I am trying to get a while loop that will execute 5 time then stop. Copngratulations, you have succeeded. Unfortunately nothing happens inside your loop. I suspect you actually want to execute some code 5 times? #counter = 0 #while counter < 5 : #cou

Re: [Tutor] While loop counter

2008-07-07 Thread John Fouhy
On 08/07/2008, David <[EMAIL PROTECTED]> wrote: > Hi, I am trying to get a while loop that will execute 5 time then stop. Hi David, The standard pattern is like this: i = 0 while i < 5: # the stuff you want to do goes here i = i + 1 Note that if you know exactly how many times you will

[Tutor] While loop counter

2008-07-07 Thread David
Hi, I am trying to get a while loop that will execute 5 time then stop. #!/usr/bin/python # Filename myfirstclass.py # # A Little digital clock from time_class import Time import sys import time mytime = Time() print "Can you tell me the time (24h)?" hour = input("Give the hour: ") minute = in

Re: [Tutor] while Loop

2007-07-26 Thread Mike Hansen
> -Original Message- > Subject: Re: [Tutor] while Loop > > Oops, didn't notice the uppercase U, thanks Luke. > > - Original Message - > Subject: Re: [Tutor] while Loop > > > >> define it with usedPocketsOne = 192000? > > no, I

Re: [Tutor] while Loop

2007-07-18 Thread Darren Williams
Oops, didn't notice the uppercase U, thanks Luke. - Original Message - From: "Luke Paireepinart" <[EMAIL PROTECTED]> To: "Darren Williams" <[EMAIL PROTECTED]> Cc: Sent: Wednesday, July 18, 2007 3:08 PM Subject: Re: [Tutor] while Loop > Darren

Re: [Tutor] while Loop

2007-07-18 Thread Luke Paireepinart
Darren Williams wrote: > Luke and Kent, you're right, I didn't think JavaScript calculated > multiplaction and division before addition and subtraction but seems > it does :) > > I dunno what you mean about usedPocketsOne not being defined, didn't I > define it with usedPocketsOne = 192000? no,

Re: [Tutor] while Loop

2007-07-18 Thread Darren Williams
age - From: "Luke Paireepinart" <[EMAIL PROTECTED]> To: "Darren Williams" <[EMAIL PROTECTED]> Cc: Sent: Wednesday, July 18, 2007 11:57 AM Subject: Re: [Tutor] while Loop > Darren Williams wrote: >> Hi all, >> I'm writing a calculator for

Re: [Tutor] while Loop

2007-07-18 Thread Luke Paireepinart
Darren Williams wrote: > Hi all, > > I'm writing a calculator for an online game that I used to play but > don't seem to be able to break out of the while loop, the program will > just go over and over the loop, crashing the program and I don't know > if Python is just really slow at this type

Re: [Tutor] while Loop

2007-07-18 Thread Kent Johnson
Darren Williams wrote: > Hi all, > > I'm writing a calculator for an online game that I used to play but > don't seem to be able to break out of the while loop, the program will > just go over and over the loop, crashing the program and I don't know if > Python is just really slow at this type

[Tutor] while Loop

2007-07-18 Thread Darren Williams
Hi all, I'm writing a calculator for an online game that I used to play but don't seem to be able to break out of the while loop, the program will just go over and over the loop, crashing the program and I don't know if Python is just really slow at this type of thing or i'm doing it completely

Re: [Tutor] "while" loop for satisfing two conditions , advice requested

2006-01-15 Thread Pujo Aji
in understanding while loop someone should understand "if conditional" first.In "If conditional" there are common relational symbol "and" and "or"Let's discuss  "and" conditional Condition 1 Condition 2  ResultTrue    True    TrueTrue    F

Re: [Tutor] "while" loop for satisfing two conditions ,

2006-01-15 Thread Kent Johnson
> From: John Joseph <[EMAIL PROTECTED]> >I am trying to use “while” loop , here I want > while loop to check for two conditions , I am not > getting an idea how to use “while” loop for checking > two conditions > I used "&" condition , but it is not > giving me the expect

Re: [Tutor] "while" loop for satisfing two conditions , advice requested

2006-01-15 Thread Carlo Capuano
Hi >while (condition no 1) & (condition no2): > print "Results" > While (condition no 1) and (condition no2): print "Results" in python you use the words and, or, not, is like: if myvar1 is not None and myvar2 == '1': print 'what a nice snowing day!' Carlo what

[Tutor] "while" loop for satisfing two conditions , advice requested

2006-01-15 Thread John Joseph
Hi I am trying to use “while” loop , here I want while loop to check for two conditions , I am not getting an idea how to use “while” loop for checking two conditions I used "&" condition , but it is not giving me the expected results I used in this way

Re: [Tutor] While loop exercise

2005-05-22 Thread Andrei
. , hotmail.com> writes: > I just finished the chapter which includes while loop, if-else-elif > structure and randrange(). > > Can anyone suggest me 3 exercises to remind of the chapter? The standard exercise which includes all three would be a number guessing game where the computer picks a

[Tutor] While loop exercise

2005-05-21 Thread . ,
Hi, I just finished the chapter which includes while loop, if-else-elif structure and randrange(). Can anyone suggest me 3 exercises to remind of the chapter? Exercises shouldn't be too difficult because i'm newbie! Looking forward to writing some programs! Thanks. __