+ 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)
3 odpowiedzi
+ 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
+ 2
https://code.sololearn.com/c0VHwkg5Blei/?ref=app
+ 1
370 and 371 are both armstrong numbers. Nothing wrong with that