Why do I get 'None' after I execute this code:
list_1 = ['a', 'b', 'c']
list_2 = list_1.reverse()
print(list_2)
Thank you.
Why do I get 'None' after I execute this code:
list_1 = ['a', 'b', 'c']
list_2 = list_1.reverse()
print(list_2)
Thank you.
list_1.reverse() returns None, but instead it reverses list_1 itself.
In order to get a reversed result of list_1, you should do like this:
list_1 = ['a', 'b', 'c']
list_2 = list_1.copy()
list_2.reverse()
print(list_2)