You can apply a function f(x) on each element of a list A using the built in function map()
def f(x):
return x**2 =1
A = [ 1, 2, 4, 0, 11, 10]
B = map(f, Z)
This gives an interesting idiom
C = map(int, raw_input().strip().split())
this takes space separated integers as input and stores in C.
def f(x):
return x**2 =1
A = [ 1, 2, 4, 0, 11, 10]
B = map(f, Z)
This gives an interesting idiom
C = map(int, raw_input().strip().split())
this takes space separated integers as input and stores in C.