Re: [Tutor] Floating Confusion

2007-08-22 Thread Luke Paireepinart
Chris Calloway wrote: > wormwood_3 wrote: > >> The second case is, of course, what is throwing me. By having a decimal >> point, "1.1" is a float type, and apparently it cannot be represented by >> binary floating point numbers accurately. I must admit that I do not >> understand why this is

Re: [Tutor] xls file

2007-08-22 Thread Kirk Bailey
here s one line from a spreadsheet, as saved in python; [text:u'Bob Dobbs', number:0.0, number:1.0, text:u'n/0!', number:0.0, number:0.0, number:0.0, number:0.0, number:0.0, number:0.0] [text:u'Connie Dobbs', number:22.0, number:4.0, number:0.17001, number:11.0, number:0.5, number:6.0,

Re: [Tutor] [SPAM] A fun puzzle

2007-08-22 Thread Jeff Johnson
> -Original Message- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf > Of R. Alan Monroe > Sent: Wednesday, August 22, 2007 5:41 PM > To: Python Tutorlist > Subject: [SPAM] [Tutor] A fun puzzle > Importance: Low > > I wrote a lame, but working script to solve this in a few mi

Re: [Tutor] A fun puzzle

2007-08-22 Thread Kent Johnson
R. Alan Monroe wrote: > I wrote a lame, but working script to solve this in a few minutes. A > fun puzzle. FWIW here is my fastest solution: from itertools import chain def compute(): str_=str; int_=int; slice_=slice(None, None, -1) for x in chain(xrange(1, 101, 10), xrange(2, 1

Re: [Tutor] A fun puzzle

2007-08-22 Thread John Fouhy
On 23/08/07, Ian Witham <[EMAIL PROTECTED]> wrote: > An interesting sequence! I assumed the next two numbers would be 8799912, > 9899901 Hmm... http://www.research.att.com/~njas/sequences/?q=8712%2C+9801%2C+87912%2C+98901%2C+879912%2C+989901&language=english&go=Search http://mathworld.wolfram.com

Re: [Tutor] A fun puzzle

2007-08-22 Thread Eric Brunson
R. Alan Monroe wrote: > I wrote a lame, but working script to solve this in a few minutes. A > fun puzzle. > > http://weblogs.asp.net/jgalloway/archive/2006/11/08/Code-Puzzle-_2300_1-_2D00_-What-numbers-under-one-million-are-divisible-by-their-reverse_3F00_.aspx > > Fun! for x in xrange(1, 100

Re: [Tutor] A fun puzzle

2007-08-22 Thread John Fouhy
On 23/08/07, R. Alan Monroe <[EMAIL PROTECTED]> wrote: > I wrote a lame, but working script to solve this in a few minutes. A > fun puzzle. > > http://weblogs.asp.net/jgalloway/archive/2006/11/08/Code-Puzzle-_2300_1-_2D00_-What-numbers-under-one-million-are-divisible-by-their-reverse_3F00_.aspx >>

[Tutor] A fun puzzle

2007-08-22 Thread R. Alan Monroe
I wrote a lame, but working script to solve this in a few minutes. A fun puzzle. http://weblogs.asp.net/jgalloway/archive/2006/11/08/Code-Puzzle-_2300_1-_2D00_-What-numbers-under-one-million-are-divisible-by-their-reverse_3F00_.aspx Alan ___ Tutor mai

Re: [Tutor] Floating Confusion

2007-08-22 Thread Chris Calloway
wormwood_3 wrote: > The second case is, of course, what is throwing me. By having a decimal > point, "1.1" is a float type, and apparently it cannot be represented by > binary floating point numbers accurately. I must admit that I do not > understand why this is the case. Would anyone be able to

Re: [Tutor] Table Joins

2007-08-22 Thread Terry Carroll
On Wed, 22 Aug 2007, Kent Johnson wrote: > Terry's ideas are good but it might be as simple as > a3 = a1 + a2 > if you don't need to worry about duplicates. Doh! I was thinking the no duplicates was part of it, but you're right; that's nowhere in the OP's question. _

Re: [Tutor] Floating Confusion

2007-08-22 Thread Kent Johnson
wormwood_3 wrote: 1.1 > 1.1001 > The second case is, of course, what is throwing me. By having a > decimal point, "1.1" is a float type, and apparently it cannot be > represented by binary floating point numbers accurately. I must admit > that I do not understand why this is the c

[Tutor] Floating Confusion

2007-08-22 Thread wormwood_3
Dear Tutors, Reading through Wesley's delightful Core Python Programming, I came across something I have not been able to grasp yet. Some introductory code: >>> 1 1 >>> 1.1 1.1001 >>> print 1 1 >>> print 1.1 1.1 The second case is, of course, what is throwing me. By having a decim

Re: [Tutor] Need Some Help

2007-08-22 Thread Carroll, Barry
> An HTML attachment was scrubbed... > URL: > http://mail.python.org/pipermail/tutor/attachments/20070822/a0813e4e/att ac > hment-0001.htm > > -- > > ___ > Tutor maillist - Tuto

Re: [Tutor] Table Joins

2007-08-22 Thread Kent Johnson
z machinez wrote: > Hi All: > > I have the following tables selected from a database: > > a1 > > a2 > > each table are of the same column length, same col names. How do I > combine or concatenate these tables ? So, I would like to have > > a3 = a1, a2 # combining all the rows into one fo

Re: [Tutor] Table Joins

2007-08-22 Thread Terry Carroll
On Wed, 22 Aug 2007, Terry Carroll wrote: > If you want to pull them out of the database as a single table > I was wondering that myself the other day. I was planning on looking > into whether you could just do a FULL OUTER JOIN (which is essentially a > union operation) on both tables. I

Re: [Tutor] Table Joins

2007-08-22 Thread Terry Carroll
On Wed, 22 Aug 2007, z machinez wrote: > Hi All: > > I have the following tables selected from a database: > > a1 > > a2 > > each table are of the same column length, same col names. How do I combine > or concatenate these tables ? So, I would like to have > > a3 = a1, a2 # combining all the

[Tutor] Table Joins

2007-08-22 Thread z machinez
Hi All: I have the following tables selected from a database: a1 a2 each table are of the same column length, same col names. How do I combine or concatenate these tables ? So, I would like to have a3 = a1, a2 # combining all the rows into one formal table Just not sure how to do that in Pyth

[Tutor] iterate list items as lvalue

2007-08-22 Thread János Juhász
Dear All, I would like to thanks for your responds. Ricardo Aráoz wrote: Kent Johnson wrote: > Dave Kuhlman wrote: >> Consider the following: >> >> >>> array = [1,2,3,4,5] >> >>> array2 = array >> >>> array = [i * 2 for i in array] >> >>> array >> [2, 4, 6,

Re: [Tutor] xls file

2007-08-22 Thread Kent Johnson
Kirk Bailey wrote: > I extracted cell 0,0 and it is > >>> x > u'Bob Dobbs' > >>> > > So I did this: > >>> str(x) > 'Bob Dobbs' > >>> > >>> b[1:-1] > 'ob Dobb' > >>> > oops... well,then i did this > >>> print b > Bob Dobbs > >>> > which is as I need it. any use to the rest of the list? You

Re: [Tutor] Need Some Help

2007-08-22 Thread Kent Johnson
chinni wrote: > Hi All, > > I am new to python.i need some help about python.i want to learn python > so plz guide me from where can i start.so,that i can learn and under > stand quickly. Read one of the tutorials here: http://wiki.python.org/moin/BeginnersGuide/NonProgrammers Ask questions on

Re: [Tutor] subprocess and su

2007-08-22 Thread Michael Meier
> how I thought that it was supposed to work was it would allow me to use > sbp.communicate() to > send stuff to the stdin, and get information out. What do get is a prompt > ask for my password. I believe that su does not read its input from stdin but from its controlling tty. So you'd have to o

[Tutor] Need Some Help

2007-08-22 Thread chinni
Hi All, I am new to python.i need some help about python.i want to learn python so plz guide me from where can i start.so,that i can learn and under stand quickly. -- Best Regards, M.Srikanth Kumar, ___ Tutor maillist - Tutor@python.org http://mail.p