Timeline for Test a number for narcissism
Current License: CC BY-SA 3.0
19 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jun 17, 2020 at 9:04 | history | edited | CommunityBot |
Commonmark migration
|
|
Apr 23, 2019 at 23:50 | comment | added | MilkyWay90 | You can actually get 43 bytes using Python 2 | |
Apr 23, 2019 at 23:45 | comment | added | MilkyWay90 |
Wouldn't lambda s:int(s)==sum(int(c)**len(s)for c in s) work?
|
|
Nov 8, 2016 at 15:39 | comment | added | mbomb007 | Fixed your byte count. Also, you can remove those 2 spaces on the first line. | |
Nov 8, 2016 at 15:38 | history | edited | mbomb007 | CC BY-SA 3.0 |
deleted 31 characters in body
|
Jan 9, 2014 at 20:02 | comment | added | Eduard Florinescu | Was workin on the same approach:( | |
Nov 21, 2013 at 2:35 | history | edited | danmcardle | CC BY-SA 3.0 |
added 3 characters in body
|
Nov 21, 2013 at 2:35 | comment | added | danmcardle | You're absolutely right. Rather than add the four characters, I'll just switch it back to Python3 where it was 57 chars. | |
Nov 18, 2013 at 19:16 | comment | added | AMK |
In Python 2.7 first row must by s=raw_input()
|
|
Nov 18, 2013 at 18:24 | comment | added | Martin Thoma |
I think you should point out that adding braces to print (hence one character more) would make this a valid Python 2.x and Python 3.x solution.
|
|
Nov 17, 2013 at 5:32 | comment | added | danmcardle | Good point, edited. | |
Nov 17, 2013 at 5:31 | history | edited | danmcardle | CC BY-SA 3.0 |
saving characters
|
Nov 16, 2013 at 17:31 | comment | added | Ben |
You can save two characters by removing the spaces in s = input() and another one by moving this to 2.7 where print isn't a function.
|
|
S Nov 16, 2013 at 17:14 | history | suggested | oefe | CC BY-SA 3.0 |
Formatting
|
Nov 16, 2013 at 16:37 | review | Suggested edits | |||
S Nov 16, 2013 at 17:14 | |||||
Nov 14, 2013 at 12:07 | history | edited | danmcardle | CC BY-SA 3.0 |
shrinking code
|
Nov 14, 2013 at 12:05 | comment | added | danmcardle | That's awesome! Thanks for the tip. | |
Nov 14, 2013 at 7:12 | comment | added | marinus |
The [ and ] are unnecessary, and you can drop the space in front of for too, so: sum(int(c)**len(s)for c in s)
|
|
Nov 14, 2013 at 3:08 | history | answered | danmcardle | CC BY-SA 3.0 |