New submission from Sivasundar Nagarajan <sivasundar.nagara...@in.ibm.com>:
Good day. Hope you are safe and wish the same with the present situation. Need you help please in understanding the below function of Python. Steps - 1. tried assigning the below values in the list and named it as a 2.if I print, it prints in the same sequence. 3.Tried assigning it to b by the command a.sort() 4.Tried printing b and it gave null. 5.But printed a now, and the values were sorted. Please help me understand if we have any logic with in a list to sort the values after an iteration. Please apologize if I had missed some basics and uncovered it. >>> a = [1,4,3,2,4,5,3,2] >>> a [1, 4, 3, 2, 4, 5, 3, 2] >>> print (a) [1, 4, 3, 2, 4, 5, 3, 2] >>> b = a.sort() >>> b >>> print (a) [1, 2, 2, 3, 3, 4, 4, 5] >>> ---------- assignee: terry.reedy components: IDLE messages: 365129 nosy: Sivasundar Nagarajan, terry.reedy priority: normal severity: normal status: open title: List sorting type: resource usage versions: Python 3.8 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue40081> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com