Timeline for Output the sign
Current License: CC BY-SA 3.0
9 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jun 28, 2017 at 2:12 | history | edited | totallyhuman | CC BY-SA 3.0 |
added 2 characters in body
|
Dec 23, 2016 at 16:19 | comment | added | Phlarx |
@Dillanm You can, actually, but it's several bytes longer: n and n//abs(n)
|
|
Dec 23, 2016 at 9:38 | comment | added | Dillanm |
@Phlarx It would have been possible if Python had a way of negating the divide by zero, a la JavaScript per BookOwl solution above x=>x/Math.abs(x)|0
|
|
Dec 22, 2016 at 16:16 | comment | added | Phlarx | @Dillanm ah, right. Didn't catch that, obvious in hindsight :P | |
Dec 22, 2016 at 9:40 | comment | added | Dillanm | @Phlarx that will cause divide by zero error as n (and abs n) can be zero | |
Dec 21, 2016 at 21:28 | comment | added | Phlarx |
How about n//abs(n) for two bytes
|
|
Dec 21, 2016 at 11:37 | comment | added | Dillanm | @KritixiLithos practically but it's also an entirely different llanguage | |
Dec 21, 2016 at 11:35 | comment | added | user41805 | Practically the same as this answer: codegolf.stackexchange.com/a/103831/41805 | |
Dec 21, 2016 at 11:33 | history | answered | Dillanm | CC BY-SA 3.0 |