On 2/14/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Every example of a list that I've seen involves working with, sorting, etc > pre-populated list. How can I create a list where the user inputs a string > of numbers and then sorts it?
The code of yours gets a commaseparated _string_, which you are putting into a list. The list contains one element only; the string you entered. What you want to do is this: print "Input list separated by commas" foo = raw_input() lst = foo.split(",") print lst print len(lst) lst.sort() print lst > leading me to believe that it is seeing > the input as 1 large input instead of separate numbers. Correct. raw_input() is not smart enough to split the elements for you, so you need to do the dirty work. The string-method "split" does this. Type help("".split) for more info. -- - Rikard. _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor