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

2013-05-15 Thread Bhanu Pratap Singh
Subject: [Tutor] changing char list to int list isn't working 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

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

2013-05-04 Thread Alan Gauld
On 04/05/13 05: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, You don't actually need to convert to chars, you could use divmod to do it directly on the numbers: digits = [] root = 455

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

2013-05-04 Thread Mitya Sirenef
On 05/04/2013 12:13 AM, Jim Mooney wrote: for num in listOfNumChars: num = int(num) It seems like people learning Python run into this very often. I think the reason is that in most simple cases, it's easier and more intuitive to think that the name IS the object: x = 1 y = 2 print x +

[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 =

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 cybervigila...@gmail.com 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?

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))