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] (no subject)

2013-04-06 Thread Mark Lawrence
On 07/04/2013 00:10, Soliman, Yasmin wrote: To quote John McEnroe "You cannot be serious". Thankfully Steven D'Aprano has already given you a roadmap to follow. I'll point out a few things that should assist. How can I fix this loop so that it multiplies the two intergers and if user types

Re: [Tutor] (no subject)

2013-04-06 Thread Steven D'Aprano
On 07/04/13 09:10, Soliman, Yasmin wrote: How can I fix this loop so that it multiplies the two intergers and if user types in 'quit' for either number it stops? if not it keeps going. How would you solve this problem in real life? Right down the steps you would do, as if you were explaining

Re: [Tutor] loop questions

2013-04-06 Thread Steven D'Aprano
On 07/04/13 08:00, Soliman, Yasmin wrote: I have two questions on these simple programs: 1st why does this loop keep repeating after I enter 'Quit'? The code you give below is not valid Python code. Please copy and paste *actual* the code you use, do not retype it from memory. I know that it

[Tutor] (no subject)

2013-04-06 Thread Soliman, Yasmin
How can I fix this loop so that it multiplies the two intergers and if user types in 'quit' for either number it stops? if not it keeps going. def multiply_integers(int1,int2): print int1*int2 int1=float(input('Please enter 1st integer: ')) int2=float(input('Please enter 2nd integer: '))

Re: [Tutor] loop questions

2013-04-06 Thread Mark Lawrence
On 06/04/2013 23:00, Soliman, Yasmin wrote: I have two questions on these simple programs: 1st why does this loop keep repeating after I enter 'Quit'? import calendar m = raw_input(“Enter a year: “) while m != “Quit”: if calendar.isleap(int(m)): print “%d is a leap year” % (int(m)) else:

Re: [Tutor] loop questions

2013-04-06 Thread Mitya Sirenef
On 04/06/2013 06:00 PM, Soliman, Yasmin wrote: I have two questions on these simple programs: > > 1st why does this loop keep repeating after I enter 'Quit'? > > import calendar > m = raw_input(“Enter a year: “) > while m != “Quit”: > if calendar.isleap(int(m)): > print “%d is a leap year” %

[Tutor] loop questions

2013-04-06 Thread Soliman, Yasmin
I have two questions on these simple programs: 1st why does this loop keep repeating after I enter 'Quit'? import calendar m = raw_input(“Enter a year: “) while m != “Quit”: if calendar.isleap(int(m)): print “%d is a leap year” % (int(m)) else: print “%d is not a leap year” % (int(m)) 2n

Re: [Tutor] Socket Programming

2013-04-06 Thread Alan Gauld
On 05/04/13 11:47, Mousumi Basu wrote: s=socket.socket(socket.AF_INIT,socket.SCK_DGRM)) There is a double )) at the end of the line. That should give a different error so I assume this is not cut 'n paste code, but just in case I thought I'd point it out... s.bind(('172.18.2.11',8032)) Be