Hi all, I'm trying to use a list comprehension in Python to filter and modify a list, but it's not giving me the output I expect. Here's a snippet of my code:
numbers = [1, 2, 3, 4, 5, 6] new_numbers = [x*2 for x in numbers if x % 2 == 0 else x] I want to double the even numbers and leave the odd numbers as they are, but I'm getting a syntax error. Can someone point out what I'm doing wrong? Appreciate any help! https://thesuperions.com/sophie-rain-spiderman/ _______________________________________________ Isbg mailing list -- isbg@python.org To unsubscribe send an email to isbg-le...@python.org https://mail.python.org/mailman3/lists/isbg.python.org/ Member address: arch...@mail-archive.com