I have this bit of a practice code:
even = []
odd = []
for x in range(1000):
if x % 2 != 0:
odd.append(x)
else:
even.append(x)
print map(lambda x: x if str(x)[-1] == '2' else pass, even)
print even
print odd
In my mind, I should get in the end full list of odd numbers in 0 - 999 range and a list of even numbers from the same range which do not end with "2". In practice however, I keep on getting syntax error pointing to the "pass" in lambda expression.
What am I doing wrong here?
Cheers, Greem
x % 10 == 2