+ 4

why it prints None?

lista = [1,2,3,4,5,6] print(lista.extend([7,8]))

27th Dec 2018, 8:22 AM
sky
sky - avatar
2 Respostas
+ 10
print() is supposed to display the return value of the lista.extend() method. But there's nothing to return really, it just extends lista by the list [7, 8]. So the default return value, None, is printed. If you want to see how lista looks now, just print it after extending: lista.extend([7,8]) print(lista) Hope that helps 😊
27th Dec 2018, 8:44 AM
Kishalaya Saha
Kishalaya Saha - avatar
+ 4
It Doesn't return anything, sice get a none🤗
27th Dec 2018, 6:52 PM
Mr_¢hito•°•
Mr_¢hito•°• - avatar