On Tue, 23 Aug 2005, Jonas Melian wrote: > I get a list of repeated numbers [24, 24, 24, 16, 16, 15, 15 ] > Is possible get it without repeated numbers, without using set()? > > If I use set, then the list is unsorted and i cann't sorting it.
Converting it to a set will eliminate dupes, and converting it back to list will make it sortable. I don't know if you're in a position to rely on the sortedness of the input data, but even if not, this works: >>> l=[24, 24, 15, 16, 16, 15, 24] >>> l=sorted(list(set(l)), reverse=True) >>> l [24, 16, 15] _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor