+ 1

Why "print(Letter.reverse())" gives output as None!?

I tried "Letters.reverse()" which put the objects in the list in reverse index. And if I try "print(letters)" then it shows correct output. But I tried "print(letters.reverse())", what is the reason that it gives the output as "None"!?

26th Jun 2019, 10:09 PM
Manoj Thakkar
4 odpowiedzi
+ 1
Thank you ~ swim ~ !!!
26th Jun 2019, 10:35 PM
Manoj Thakkar
+ 1
There are such called inplace methods, that are often used on mutable objects, such as lists and dictionaries. Inplace methods modify the object self, but aren't often supposed to return anything. list.append is an inplace method. Immutable objects don't have such inplace methods.
27th Jun 2019, 1:41 AM
Seb TheS
Seb TheS - avatar