+ 2

Print the first 20 narcissistic numbers

My project is to generate the first 20 armstrong numbers.I have been able to generate the numbers,but the number 370 gets repeated twice. my code is: def print_narcissistic_nums(start, end): for i in range(start, end + 1): digits = list(map(int, str(i))) total = 0 length = len(digits) for d in digits: total += d ** length if total == i: print(i) print_narcissistic_nums(0, 11000)

22nd Aug 2019, 6:22 AM
Earl
3 Antworten
+ 5
hum 370 is very narcissistic lol a condition in which this number is having an inflated sense of its own importance, a deep need for excessive attention and admiration,  nice https://code.sololearn.com/cucvayt9jw7M/?ref=app
22nd Aug 2019, 6:37 AM
BroFar
BroFar - avatar
+ 2
https://code.sololearn.com/c0VHwkg5Blei/?ref=app
22nd Aug 2019, 7:26 AM
Trigger
Trigger - avatar
+ 1
370 and 371 are both armstrong numbers. Nothing wrong with that
22nd Aug 2019, 7:25 AM
Trigger
Trigger - avatar