1 | initial version |
When you evaluate list1.remove(2)
, it modifies list1
and always returns None
. It does not return the modified list. So:
sage: list1 = [1,2,3]
sage: list1.remove(2)
sage: list1
[1, 3]
Note that there is no output from the second line: it returns nothing. This in contrast to something like the sorted
function which does not modify the original list but instead returns a new sorted list:
sage: list1 = [3,2,1]
sage: sorted(list1)
[1, 2, 3]
sage: list1
[3, 2, 1]