def modify_list(l):
m =[]
for z in l:
if z % 2 == 0:
m.append(int(z // 2))
return m
l = [int(i) for i in input().split()]
modify_list(l)
print(l)
def modify_list(l):
tmp = [el for el in l if not el%2]
l.clear()
l.extend(tmp)
for i in range(len(l)):
l[i] //= 2
l = [int(i) for i in input().split()]
modify_list(l)
print(l)
Never use the characters 'l' (lowercase letter el), 'O' (uppercase letter oh), or 'I' (uppercase letter eye) as single character variable names.
In some fonts, these characters are indistinguishable from the numerals one and zero. When tempted to use 'l', use 'L' instead.
def modify_list(l):
m =[]
for z in l:
if z % 2 == 0:
m.append(int(z // 2))
return m
l = [int(i) for i in input().split()]
a = modify_list(l)
print(a)