reversing list issue
Title
Question
we have used sorted(marks,reverse=True)
why can't we use marks.sort(reverse=True) to perform changes in marks itself ?
Python-3.4.3 Manipulating-lists 08-09 min 30-40 sec
Answers:
Both are correct ways to do reversal. The difference is that .sort will sort the list in place while sorted will create a new list.
Login to add comment