Thankyou. got it. On Sat, Apr 15, 2017 at 5:44 AM, Steven D'Aprano <st...@pearwood.info> wrote:
> On Fri, Apr 14, 2017 at 11:59:25PM +0530, shubham goyal wrote: > > > sorted(ls) > > sorted(ls1) > > Here you sort ls and throw the result away, then you do the same to ls1. > > sorted() makes a copy of the list and sorts it. You need to write: > > ls = sorted(ls) > ls1 = sorted(ls1) > > but even better would be to sort in place: > > ls.sort() > ls1.sort() > > which doesn't make a copy. > > > > -- > Steve > _______________________________________________ > Tutor maillist - Tutor@python.org > To unsubscribe or change subscription options: > https://mail.python.org/mailman/listinfo/tutor > _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor