Re: [Tutor] changing char list to int list isn't working

2013-05-03 Thread Steven D'Aprano
On 04/05/13 14:13, Jim Mooney wrote: I'm turning an integer into a string so I can make a list of separate chars, then turn those chars back into individual ints, but the resulting list still looks like string chars when I print it. What am I doing wrong? listOfNumChars = list(str(intNum)) Thi

Re: [Tutor] changing char list to int list isn't working

2013-05-03 Thread eryksun
On Sat, May 4, 2013 at 12:13 AM, Jim Mooney wrote: > I'm turning an integer into a string so I can make a list of separate > chars, then turn those chars back into individual ints, but the > resulting list still looks like string chars when I print it. What am > I doing wrong? > > listOfNumChars =

[Tutor] changing char list to int list isn't working

2013-05-03 Thread Jim Mooney
I'm turning an integer into a string so I can make a list of separate chars, then turn those chars back into individual ints, but the resulting list still looks like string chars when I print it. What am I doing wrong? listOfNumChars = list(str(intNum)) for num in listOfNumChars: num = int(nu

Re: [Tutor] Why do I not get the same results for these two functions when I pass 7 as an argument?

2013-05-03 Thread Dave Angel
On 05/03/2013 12:51 PM, Nonso Ibenegbu wrote: Great! Many thanks for the help offered. The background of the problem is that if I book a certain service for 1 or 2 days I pay $40 per day, if I book 3, 4, 5 or 6 days I get $20 off but if I book above 7 days I get $50 off. The first function does

Re: [Tutor] creating a corpus from a csv file

2013-05-03 Thread Alan Gauld
On 03/05/13 21:48, Treder, Robert wrote: I'm very new to python and am trying to figure out how to > make a corpus from a text file. Hi, I for one have no idea what a corpus is or looks like so you will need to help us out a little before we can help you. I have a csv file (actually pipe '|'

[Tutor] creating a corpus from a csv file

2013-05-03 Thread Treder, Robert
Hi, I'm very new to python and am trying to figure out how to make a corpus from a text file. I have a csv file (actually pipe '|' delimited) where each row corresponds to a different text document. Each row contains a communication note. Other columns correspond to categories of types of com

Re: [Tutor] Why do I not get the same results for these two functions when I pass 7 as an argument?

2013-05-03 Thread Danny Yoo
> elif days >= 3 < 7: This condition here, as well as: > if days >= 3 < 7: this condition here, looks very suspicious. Can you say what you trying to express here? ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription

Re: [Tutor] Why do I not get the same results for these two functions when I pass 7 as an argument?

2013-05-03 Thread Alan Gauld
On 03/05/13 17:51, Nonso Ibenegbu wrote: The second function breaks down when the argument is 7 or above. Yet the only difference is that the condition "if days >= 7:" comes first in the first function but comes second (as "elif days >= 7:") in the second code. Yes but that's because the othe

Re: [Tutor] Why do I not get the same results for these two functions when I pass 7 as an argument?

2013-05-03 Thread Nonso Ibenegbu
Great! Many thanks for the help offered. The background of the problem is that if I book a certain service for 1 or 2 days I pay $40 per day, if I book 3, 4, 5 or 6 days I get $20 off but if I book above 7 days I get $50 off. The first function does the job! The second function breaks down when

Re: [Tutor] Why do I not get the same results for these two functions when I pass 7 as an argument?

2013-05-03 Thread Kengesbayev, Askar
You need to change the condition statement: if days >= 3 < 7: to thisif days >= 3 and days < 7: When it goes through the function it sees this statement days >= 3 as true and execute - payment -20. Askar From: Nonso Ibenegbu [mailto:jollyn...@gmail.com] Sent: Friday, May 03, 2013 2:10

Re: [Tutor] query from sqlalchemy returns AttributeError: 'NoneType' object

2013-05-03 Thread Alan Gauld
On 02/05/13 23:13, Karthik Sharma wrote: This doesn't have much to do with learning Python and a lot to do with SqlAlchemy so you'd be better off asking on a SqlAlchemy forum I suspect. However, some basic debugging investigation first may help your cause. For example... Traceback (most

Re: [Tutor] Why do I not get the same results for these two functions when I pass 7 as an argument?

2013-05-03 Thread Mark Lawrence
On 03/05/2013 07:10, Nonso Ibenegbu wrote: Hello everyone, Wonder if someone can help me understand why these two codes do not give the same results for what looks essentially the same ("?") code. The argument passed is 7. def rental_car_cost(days): payment = days * 40 if days >= 7: