Re: [Tutor] Debugging While Loops for Control

2012-02-16 Thread Alan Gauld
On 16/02/12 04:57, Luke Thomas Mergner wrote: My problem is that I am using two functions that return True or False to determine whether the player receives another card. Because of the way it evaluates the while condition, it either prints too little information or previously called the

[Tutor] How to convert seconds to hh:mm:ss format

2012-02-16 Thread alain Delon
userName = raw_input(Enter your name )      print hi + userName + . \n      seconds = input(Enter the number of seconds since midnight:)      hours = seconds/3600      hoursRemain = hours%60      minutes = hoursReamain/60      secondsRemain = minutes%60      print hours: + minutes: + seconds

Re: [Tutor] How to convert seconds to hh:mm:ss format

2012-02-16 Thread Prasad, Ramit
userName = raw_input(Enter your name ) print hi + userName + . \n seconds = input(Enter the number of seconds since midnight:) hours = seconds/3600 hoursRemain = hours%60 minutes = hoursReamain/60 secondsRemain = minutes%60 print hours: + minutes: + seconds

Re: [Tutor] How to convert seconds to hh:mm:ss format

2012-02-16 Thread Martin A. Brown
Welcome to the joys of time and date handling. : userName = raw_input(Enter your name ) :      print hi + userName + . \n :      seconds = input(Enter the number of seconds since midnight:) :      hours = seconds/3600 :      hoursRemain = hours%60 :      minutes = hoursReamain/60 :      

Re: [Tutor] How to convert seconds to hh:mm:ss format

2012-02-16 Thread Dave Angel
On 02/16/2012 04:46 PM, alain Delon wrote: userName = raw_input(Enter your name ) print hi + userName + . \n seconds = input(Enter the number of seconds since midnight:) hours = seconds/3600 hoursRemain = hours%60 minutes = hoursReamain/60 secondsRemain =

Re: [Tutor] Tutor Digest, Vol 96, Issue 69

2012-02-16 Thread Nicholas Palmer
I am fairly experienced in java and I was wondering how to use java in python code, if you could give me any tips.\ On Thu, Feb 16, 2012 at 6:00 AM, tutor-requ...@python.org wrote: Send Tutor mailing list submissions to tutor@python.org To subscribe or unsubscribe via the World Wide

[Tutor] Using Java from Python was RE: Tutor Digest, Vol 96, Issue 69

2012-02-16 Thread Prasad, Ramit
I am fairly experienced in java and I was wondering how to use java in python code, if you could give me any tips.\ Hi, Please remove any irrelevant sections of the digest if you are replying to it (which in this case is everything) and change the subject to be more descriptive. Also, top

Re: [Tutor] Tutor Digest, Vol 96, Issue 69

2012-02-16 Thread Alan Gauld
On 16/02/12 23:45, Nicholas Palmer wrote: I am fairly experienced in java and I was wondering how to use java in python code, if you could give me any tips.\ In general you don't you use Python instead of Java. But if you really must you can use Jython which is an implementation of python in

[Tutor] Python in Java [was Re: Tutor Digest, Vol 96, Issue 69]

2012-02-16 Thread Steven D'Aprano
Nicholas Palmer wrote: I am fairly experienced in java and I was wondering how to use java in python code, if you could give me any tips.\ My first tip is to learn how to use email effectively. Doing so will increase the chances that volunteers on mailing lists will answer your questions

[Tutor] finding a maximum between the absolute difference of several columns

2012-02-16 Thread Elaina Ann Hyde
Hello all, I am still scripting away and have reached my next quandry, this one is much simpler than the last, basically I read in a file with several columns. Vmatch3_1=dat[col1] Vmatch3_2=dat[col2] Vmatch3_3=dat[col3] Vdav=5.0 Vhel_fdiff3=max(abs(Vmatch3_1 - Vmatch3_2),abs(Vmatch3_1 -

Re: [Tutor] How to convert seconds to hh:mm:ss format

2012-02-16 Thread Daryl V
You've gotten some really excellent advice about how to approach working with the time format. Here's a chunk of code I use quite a bit. It's probably sub-optimal, but playing with it might help you come up with a solution that works for your application. def Int2Digit(integer): if

Re: [Tutor] finding a maximum between the absolute difference of several columns

2012-02-16 Thread Mark Lawrence
On 17/02/2012 01:04, Elaina Ann Hyde wrote: Hello all, I am still scripting away and have reached my next quandry, this one is much simpler than the last, basically I read in a file with several columns. Vmatch3_1=dat[col1] Vmatch3_2=dat[col2] Vmatch3_3=dat[col3] Vdav=5.0

Re: [Tutor] finding a maximum between the absolute difference of several columns

2012-02-16 Thread Elaina Ann Hyde
On Fri, Feb 17, 2012 at 1:41 PM, Rohan Sachdeva rsach...@usc.edu wrote: The way I would do this is to put all of the differences in a list then take the maximum of the list. So.. a = Vmatch3_1 - Vmatch3_2 b = Vmatch3_1 - Vmatch3_3 c = Vmatch3_3 - Vmatch3_2 Vhel_fdiff3=max([a,b,c]) That

Re: [Tutor] finding a maximum between the absolute difference of several columns

2012-02-16 Thread Mark Lawrence
On 17/02/2012 02:53, Elaina Ann Hyde wrote: On Fri, Feb 17, 2012 at 1:41 PM, Rohan Sachdevarsach...@usc.edu wrote: The way I would do this is to put all of the differences in a list then take the maximum of the list. So.. a = Vmatch3_1 - Vmatch3_2 b = Vmatch3_1 - Vmatch3_3 c = Vmatch3_3 -

Re: [Tutor] Debugging While Loops for Control

2012-02-16 Thread Luke Thomas Mergner
-- Message: 1 Date: Wed, 15 Feb 2012 23:57:08 -0500 From: Luke Thomas Mergner lmerg...@gmail.com To: tutor@python.org Subject: [Tutor] Debugging While Loops for Control Message-ID:

Re: [Tutor] finding a maximum between the absolute difference of several columns

2012-02-16 Thread Elaina Ann Hyde
On Fri, Feb 17, 2012 at 2:27 PM, Mark Lawrence breamore...@yahoo.co.ukwrote: On 17/02/2012 02:53, Elaina Ann Hyde wrote: On Fri, Feb 17, 2012 at 1:41 PM, Rohan Sachdevarsach...@usc.edu wrote: The way I would do this is to put all of the differences in a list then take the maximum of the

Re: [Tutor] finding a maximum between the absolute difference of several columns

2012-02-16 Thread Andre' Walker-Loud
Hi Elaina, Vhel_fdiff3=[] for i in xrange(len(Vmatch3_1)): Vhel_fdiff3.append(max([abs(Vmatch3_1[i] - Vmatch3_2[i]),abs(Vmatch3_1[i] - Vmatch3_3[i]),abs(Vmatch3_3[i] - Vmatch3_2[i])])) #print Vhel_fdiff3 #appending writes a list, but numpy which makes the with_ work needs an

Re: [Tutor] How to convert seconds to hh:mm:ss format

2012-02-16 Thread Alan Gauld
On 17/02/12 01:29, Daryl V wrote: def Int2Digit(integer): if integer 9: strInteger = 0+str(integer) else: strInteger = str(integer) return strInteger Or using format strings: def int2Digit(integer): return %02d % integer Although this doesn't behave