0

a = [2,3,4] b = [5,6,7] c = a.extend(b) print(c) # why out None?

13th Oct 2021, 11:51 PM
Khalif Baby👶
Khalif Baby👶 - avatar
2 Réponses
+ 8
Because a.extend(b) changes a, it does not return anything. Use c = a + b instead.
14th Oct 2021, 12:00 AM
Simon Sauter
Simon Sauter - avatar
- 1
a.extend(b) print(a)
14th Oct 2021, 12:03 AM
zexu knub
zexu knub - avatar