python - Why does the following code snippet returns None? -
this should append values in list val new list creating here using range method.
val = [1, 2, 3,'time is', 10, 'up'] print val.extend(range(0,10))
list.extend()
extends list object in place , returns none
.
you can print val
after extending:
val.extend(range(0,10)) print val
or use concatenation:
print val + range(0, 10)
Comments
Post a Comment