Skip to main content

Timeline for Swap the parity

Current License: CC BY-SA 4.0

7 events
when toggle format what by license comment
S Apr 9, 2021 at 20:06 review Low quality posts
Apr 9, 2021 at 20:10
S Apr 9, 2021 at 20:06 review Late answers
Apr 9, 2021 at 20:10
Apr 9, 2021 at 20:01 history edited Symmetr1cGroup CC BY-SA 4.0
added 4 characters in body
Apr 9, 2021 at 19:59 comment added Makonede You just... don't use whitespace. That's literally it. You don't need to make a function on multiple lines: def f(n):return n+(-1)**(n%2+1) works
Apr 9, 2021 at 19:58 comment added Symmetr1cGroup @Makonede Thanks for commenting, how do you remove whitespace?
Apr 9, 2021 at 19:57 comment added Makonede Welcome to Code Golf! You can save a ton by removing whitespace and using a lambda as well as modifying the algorithm a little: lambda n:abs((-1)**n-n).
Apr 9, 2021 at 19:45 history answered Symmetr1cGroup CC BY-SA 4.0