Here's a simple program:
#!/usr/bin/env python3
l = list(range(5))
print(l, type(l))
l = list(range(5)).remove(2)
print(l, type(l))
for some reason the list is destroyed on removing the element:
[0, 1, 2, 3, 4] <class 'list'>
None <class 'NoneType'>
(it is program output)
I expected it to output
[0, 1, 3, 4]
What is wrong, and how do I remove the element from a list generated with range
?