This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Sivasundar Nagarajan
Recipients Sivasundar Nagarajan, terry.reedy
Date 2020-03-27.02:26:01
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1585275962.0.0.0714871727825.issue40081@roundup.psfhosted.org>
In-reply-to
Content
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]
>>>
History
Date User Action Args
2020-03-27 02:26:02Sivasundar Nagarajansetrecipients: + Sivasundar Nagarajan, terry.reedy
2020-03-27 02:26:02Sivasundar Nagarajansetmessageid: <1585275962.0.0.0714871727825.issue40081@roundup.psfhosted.org>
2020-03-27 02:26:01Sivasundar Nagarajanlinkissue40081 messages
2020-03-27 02:26:01Sivasundar Nagarajancreate