0
Python code question (probably easy)
When I run this code, b’s value is None. a=[2,1,2,4] b=a[1:].remove(2) print(b) But doing remove on a list containing 1,2,4 should return 1,4. What am I not understanding?
1 Risposta
+ 2
b is actually being given the value returned by remove() on the list, but this method does not return any value. If you did a.remove(2) and then print(a) you will see the modified list