Re: [Tutor] A better way for greatest common divisor

2010-07-30 Thread David Hutto
On Sat, Jul 31, 2010 at 12:37 AM, David Hutto wrote: > On Fri, Jul 30, 2010 at 11:51 PM, Steven D'Aprano wrote: >> On Sat, 31 Jul 2010 01:03:27 pm David Hutto wrote: >> >>> This fixes the floating point 'bug' when numerator is greater than >>> denominator: http://python.pastebin.com/bJ5UzsBE >> >

Re: [Tutor] A better way for greatest common divisor

2010-07-30 Thread David Hutto
On Fri, Jul 30, 2010 at 11:51 PM, Steven D'Aprano wrote: > On Sat, 31 Jul 2010 01:03:27 pm David Hutto wrote: > >> This fixes the floating point 'bug' when numerator is greater than >> denominator: http://python.pastebin.com/bJ5UzsBE > > I don't mean to be disparaging ... ah hell, who am I fooling

Re: [Tutor] Python - RPG Combat System

2010-07-30 Thread Steven D'Aprano
On Sat, 31 Jul 2010 12:49:36 pm Jason MacFiggen wrote: > I am have trouble figuring out how to make my program stop at 0 hit > points if I run it, it always goes into the negative hitpoints... > > So my question is how do I make this program end at exactly 0 hit > points every time instead of g

[Tutor] Simple Python Program

2010-07-30 Thread Jason MacFiggen
Can anyone tell me how to fix the errors I am getting if possible? I'm quite new and so confused... also how do I display the winner under the displayInfo function? import random def main(): print playerOne, playerTwo = inputNames(playerOne, PlayerTwo) while endProgram == 'no':

Re: [Tutor] A better way for greatest common divisor

2010-07-30 Thread Steven D'Aprano
On Sat, 31 Jul 2010 01:03:27 pm David Hutto wrote: > This fixes the floating point 'bug' when numerator is greater than > denominator: http://python.pastebin.com/bJ5UzsBE I don't mean to be disparaging ... ah hell, who am I fooling? Yes I do. What is that mess? *wink* I can see at least four pr

Re: [Tutor] Python - RPG Combat System

2010-07-30 Thread David Hutto
On Fri, Jul 30, 2010 at 10:49 PM, Jason MacFiggen wrote: > I am have trouble figuring out how to make my program stop at 0 hit > points if I run it, it always goes into the negative hitpoints... > > So my question is how do I make this program end at exactly 0 hit points > every time instead o

Re: [Tutor] A better way for greatest common divisor

2010-07-30 Thread David Hutto
On Fri, Jul 30, 2010 at 10:44 PM, David Hutto wrote: > On Fri, Jul 30, 2010 at 10:43 PM, David Hutto wrote: >> On Fri, Jul 30, 2010 at 10:25 PM, Richard D. Moores >> wrote: >>> On Fri, Jul 30, 2010 at 17:43, David Hutto wrote: This is the url: http://python.pastebin.com/fP3jjqGj >>>

[Tutor] Python - RPG Combat System

2010-07-30 Thread Jason MacFiggen
I am have trouble figuring out how to make my program stop at 0 hit points if I run it, it always goes into the negative hitpoints... So my question is how do I make this program end at exactly 0 hit points every time instead of going over? and also, what can I do instead of writing print so

Re: [Tutor] A better way for greatest common divisor

2010-07-30 Thread David Hutto
On Fri, Jul 30, 2010 at 10:43 PM, David Hutto wrote: > On Fri, Jul 30, 2010 at 10:25 PM, Richard D. Moores > wrote: >> On Fri, Jul 30, 2010 at 17:43, David Hutto wrote: >>> This is the url: >>> http://python.pastebin.com/fP3jjqGj >> >> This is a slight revision, with my suggested changes highli

Re: [Tutor] A better way for greatest common divisor

2010-07-30 Thread David Hutto
On Fri, Jul 30, 2010 at 10:25 PM, Richard D. Moores wrote: > On Fri, Jul 30, 2010 at 17:43, David Hutto wrote: >> This is the url: >> http://python.pastebin.com/fP3jjqGj > > This is a slight revision, with my suggested changes highlighted: > > > Dick Moores >

Re: [Tutor] A better way for greatest common divisor

2010-07-30 Thread David Hutto
On Fri, Jul 30, 2010 at 10:42 PM, David Hutto wrote: > On Fri, Jul 30, 2010 at 10:25 PM, Richard D. Moores > wrote: >> On Fri, Jul 30, 2010 at 17:43, David Hutto wrote: >>> This is the url: >>> http://python.pastebin.com/fP3jjqGj >> >> This is a slight revision, with my suggested changes highli

Re: [Tutor] A better way for greatest common divisor

2010-07-30 Thread David Hutto
On Fri, Jul 30, 2010 at 10:25 PM, Richard D. Moores wrote: > On Fri, Jul 30, 2010 at 17:43, David Hutto wrote: >> This is the url: >> http://python.pastebin.com/fP3jjqGj > > This is a slight revision, with my suggested changes highlighted: > > > Dick Moores >

Re: [Tutor] A better way for greatest common divisor

2010-07-30 Thread Richard D. Moores
On Fri, Jul 30, 2010 at 17:43, David Hutto wrote: > This is the url: > http://python.pastebin.com/fP3jjqGj This is a slight revision, with my suggested changes highlighted: Dick Moores ___ Tutor maillist - Tutor@

Re: [Tutor] A better way for greatest common divisor

2010-07-30 Thread David Hutto
On Fri, Jul 30, 2010 at 2:57 PM, Richard D. Moores wrote: > On Thu, Jul 29, 2010 at 18:47, David Hutto wrote: >> This is basically to get feedback, on a better way to show the >> greatest common divisor in fraction, in order to reduce it fully, than >> the one I've come up with. I'm sure there ar

Re: [Tutor] A unicode print question

2010-07-30 Thread Peter Otten
Joel Goldstick wrote: > I was reading this: http://diveintopython.org/xml_processing/unicode.html > > and tried the exercise: > s = u'La Pe\xf1a' [image: 1] print s [image: 2] > Traceback (innermost last): > File "", line 1, in ? > UnicodeError: ASCII encodi

Re: [Tutor] A unicode print question

2010-07-30 Thread Jerry Hill
On Fri, Jul 30, 2010 at 1:33 PM, Joel Goldstick wrote: > I was reading this: http://diveintopython.org/xml_processing/unicode.html > > and tried the exercise: > > But oddly enough, when I typed it into my python shell I did NOT get the > UnicodeError, and I wonder why not: > I believe that pyth

[Tutor] A unicode print question

2010-07-30 Thread Joel Goldstick
I was reading this: http://diveintopython.org/xml_processing/unicode.html and tried the exercise: >>> s = u'La Pe\xf1a' >>> print s Traceback (innermost last): File "", line 1, in ? UnicodeError: ASCII encoding error: ordinal not in range(128) >>> print s.encode('latin-1') La Peña But oddl

Re: [Tutor] A better way for greatest common divisor

2010-07-30 Thread Richard D. Moores
On Thu, Jul 29, 2010 at 18:47, David Hutto wrote: > This is basically to get feedback, on a better way to show the > greatest common divisor in fraction, in order to reduce it fully, than > the one I've come up with. I'm sure there are better ways, so if you > have simpler method, or critique of w

[Tutor] A unicode print question

2010-07-30 Thread Joel Goldstick
I was reading this: http://diveintopython.org/xml_processing/unicode.html and tried the exercise: >>> s = u'La Pe\xf1a' [image: 1] >>> print s [image: 2] Traceback (innermost last): File "", line 1, in ? UnicodeError: ASCII encoding error: ordinal not in range(128) >>>

Re: [Tutor] Python and Abaqus

2010-07-30 Thread bob gailer
On 7/30/2010 7:44 AM, leo.ruggier...@libero.it wrote: Dear All, I am trying to have access to the Abaqus kernel by a Python script. My intention is to avoid to use the Abaqus GUI (or command line) to run a simulation. The idea is to lunch the Python script by DOS or Python module. "lunch" m

Re: [Tutor] problem with subprocess

2010-07-30 Thread Bala subramanian
Thank you so much. I could see the job running with nohup after logout. Bala On Fri, Jul 30, 2010 at 3:49 PM, Hugo Arts wrote: > On Fri, Jul 30, 2010 at 2:36 PM, Bala subramanian > wrote: > > Dear Friends, > > > > I have to do a series of job in a remote machine. I put each job in a > text > >

Re: [Tutor] problem with subprocess

2010-07-30 Thread Hugo Arts
On Fri, Jul 30, 2010 at 2:36 PM, Bala subramanian wrote: > Dear Friends, > > I have to do a series of job in a remote machine. I put each job in a text > file called 'job' as and wrote the following code that can read each line in > the text file and execute the job. > Why not just write a shells

Re: [Tutor] Python and Abaqus

2010-07-30 Thread Knacktus
Am 30.07.2010 13:44, schrieb leo.ruggier...@libero.it: Dear All, I am trying to have access to the Abaqus kernel by a Python script. My intention is to avoid to use the Abaqus GUI (or command line) to run a simulation. The idea is to lunch the Python script by DOS or Python module. The problem

[Tutor] problem with subprocess

2010-07-30 Thread Bala subramanian
Dear Friends, I have to do a series of job in a remote machine. I put each job in a text file called 'job' as and wrote the following code that can read each line in the text file and execute the job. I login to the machine and run the script as 'python job.py'. But when i logout from the machine

Re: [Tutor] Conflict with encoding in console view and file dump

2010-07-30 Thread Peter Otten
Alex Baraibar wrote: > Hello, would you please look at the comments in the code and help me with > an answer? > Thanx. > > # -*- coding: cp1252 -*- > > def festivos(): > fest = [ 'Any Nou:\t\t\t1 de enero', > 'Reis:\t\t\t\t6 de enero', > 'Festa del Treball:\t\t1 de

[Tutor] Python and Abaqus

2010-07-30 Thread leo.ruggier...@libero.it
Dear All, I am trying to have access to the Abaqus kernel by a Python script. My intention is to avoid to use the Abaqus GUI (or command line) to run a simulation. The idea is to lunch the Python script by DOS or Python module. The problem is that my Python script runs from the Abaqus command l

Re: [Tutor] finding duplicates within a tuple of tuples

2010-07-30 Thread Peter Otten
Norman Khine wrote: > Here is the latest version http://pastie.org/1066582 can this be > further improved? > # get all the duplicates and clean the products table > main.execute("SELECT product_Id, url FROM %s.product WHERE url != ''" % db) > results = main.fetchall() > > d = defaultdict(set) >

[Tutor] Conflict with encoding in console view and file dump

2010-07-30 Thread Alex Baraibar
Hello, would you please look at the comments in the code and help me with an answer? Thanx. # -*- coding: cp1252 -*- def festivos(): fest = [ 'Any Nou:\t\t\t1 de enero', 'Reis:\t\t\t\t6 de enero', 'Festa del Treball:\t\t1 de mayo', 'Sant Joan:\t\t\t24 de