Re: [Tutor] Sorting a list in ascending order [RESOLVED]

2016-04-30 Thread Steven D'Aprano
On Fri, Apr 29, 2016 at 07:05:27PM -0400, Ken G. wrote: > Martin: I have been using Python2 for several years now and I have yet > been able to change over to Python3. I am not together sure if Python3 > is now more stable to use and more commonly use. If so, I will gradually > change over but

Re: [Tutor] Sorting a list in ascending order [RESOLVED]

2016-04-29 Thread meenu ravi
That's actually two single quotes:-) both single and double quotes should work. Thanks, Meena On Apr 29, 2016 5:58 PM, "Ken G." wrote: > > On Fri, Apr 29, 2016 at 3:01 PM, Ken G. wrote: > >> In entering five random number, how can I best sort >> it

Re: [Tutor] Sorting a list in ascending order [RESOLVED]

2016-04-29 Thread Ken G.
On 04/29/2016 07:40 PM, Alan Gauld via Tutor wrote: On 29/04/16 23:58, Ken G. wrote: print ''.join(list1) #making it again as a single string Thanks, Meena, that is great! I changed your last line to: print "".join(list1) and it came out as below: 0511414453 Another quotation

Re: [Tutor] Sorting a list in ascending order [RESOLVED]

2016-04-29 Thread Alan Gauld via Tutor
On 30/04/16 00:05, Ken G. wrote: > been able to change over to Python3. I am not together sure if Python3 > is now more stable to use and more commonly use. It is definitely stable and most libraries are now converted (although a few remain v2 only). Availability of libraries is now the only

Re: [Tutor] Sorting a list in ascending order [RESOLVED]

2016-04-29 Thread Alan Gauld via Tutor
On 29/04/16 23:58, Ken G. wrote: >> print ''.join(list1) #making it again as a single string >> > > Thanks, Meena, that is great! I changed your last line to: > > print "".join(list1) and it came out as below: > > 0511414453 > > Another quotation mark was needed. No it wasn't.

Re: [Tutor] Sorting a list in ascending order

2016-04-29 Thread isaac tetteh
You can use sorted(line) but you result will be in a list if thats okay. Otherwise you can iterate the list. Sent from my iPhone > On Apr 29, 2016, at 3:03 PM, Ken G. wrote: > > In entering five random number, how can I best sort > it into ascending order, such as

Re: [Tutor] Sorting a list in ascending order [RESOLVED]

2016-04-29 Thread Ken G.
On 04/29/2016 05:10 PM, Martin A. Brown wrote: Greetings Ken and welcome to Python, Using Linux 2.7.6 in Ubuntu 14.04.4. Thanks. Thank you for this information. I have one tip for you: While Python 2.x will still be around for a while, if you are learning Python today, I'd suggest Python

Re: [Tutor] Sorting a list in ascending order [RESOLVED]

2016-04-29 Thread Ken G.
On Fri, Apr 29, 2016 at 3:01 PM, Ken G. > wrote: In entering five random number, how can I best sort it into ascending order, such as 0511414453? Using Linux 2.7.6 in Ubuntu 14.04.4. Thanks. number01 = "41" number02 =

Re: [Tutor] Sorting a list in ascending order

2016-04-29 Thread Martin A. Brown
Greetings Ken and welcome to Python, > Using Linux 2.7.6 in Ubuntu 14.04.4. Thanks. Thank you for this information. I have one tip for you: While Python 2.x will still be around for a while, if you are learning Python today, I'd suggest Python 3.x. You can read more about the differences

Re: [Tutor] Sorting a list in ascending order

2016-04-29 Thread meenu ravi
Hi Ken, As the message clearly says, the string object doesn't have an attribute "sort". You are trying to join the inputs as a single string,"line" and then you are trying to sort it. But, as you want the string in the sorted format, you should sort it first and then convert it into string, as

[Tutor] Sorting a list in ascending order

2016-04-29 Thread Ken G.
In entering five random number, how can I best sort it into ascending order, such as 0511414453? Using Linux 2.7.6 in Ubuntu 14.04.4. Thanks. number01 = "41" number02 = "11" number03 = "05" number04 = "53" number05 = "44" line = number01 + number02 + number03 + number04 + number05 print print