I'm just learning how to do list comprehensions. I was given this question:
Given a list of numbers, return the list with all even numbers doubled, and all odd numbers turned negative.
>>input_list=[72, 26, 79, 70, 20, 68, 43, -71, 71, -2]
Here is the code I wrote, but I'm not sure why I'm getting a "bad input" error:
output_list = [i * -1 if i < 0 if i%2==1 else i * 2 for i in input_list]
Can anyone tell me what is wrong with my code?