This is my code for making half and double of even and odd numbers in a list. I know that it will work with block for loop. But i want to know why list comprehension didn't work Thanks in Advance
entry = input('Enter a number list ').split()
#Convert all items to integer
data = [int(x) for x in entry]
print(data)
rslt = [(a/2 if a%2==0 else 2*a) for a in data]
print(data)
OUTPUT :
Enter a number list 3 4 5
[3, 4, 5]
[3, 4, 5]
[Program finished]