Two pure expressions:
In [360]: lst=list(range(10))
change place in place:
In [361]: for i,v in enumerate(lst): .....: lst[i]=v*2 .....: In [362]: lst Out[362]: [0, 2, 4, 6, 8, 10, 12, 14, 16, 18]
to create a new list:
In [363]: [v*2 for v in lst] Out[363]: [0, 4, 8, 12, 16, 20, 24, 28, 32, 36]
For input, I would prefer to explicitly split and convert the string:
In [365]: lst = [int(x) for x in input().split()] 10 11 0 1 2 In [366]: lst Out[366]: [10, 11, 0, 1, 2]
source share