Question: Narcissistic numbers Prompt the user for an upper and a lower bound.(Note: we will test for at least 100-50000 range) Display all the narcisstic numbers that exist between the lower and upper bounds, both inclusive. https://en.wikipedia.org/wiki/Narcissistic_number This link describes what narcisstic numbers are. A narcisstic number of order 4 is a 4-digit number, such that the number xyzd = x^4 + y^4 + z^4 + d^4 A narcisstic number of order 3 is a 3-digit number, such that the number xyz = x^3 + y^3 + z^3 e.g. 153 is a narcissistic number of order 3 as 1^3 + 5^3 + 3^3 is equal to 153 where the ^ operator indicates raised to the power of, e.g. x^3 is x raised to the power of 3. In Python, x**3 is used to calculate x raised to the power of 3.
Question: Narcissistic numbers
Prompt the user for an upper and a lower bound.(Note: we will test for at least 100-50000 range) Display all the narcisstic numbers that exist between the lower and upper bounds, both inclusive.
https://en.wikipedia.org/wiki/Narcissistic_number
This link describes what narcisstic numbers are.
-
A narcisstic number of order 4 is a 4-digit number, such that the number xyzd = x^4 + y^4 + z^4 + d^4
-
A narcisstic number of order 3 is a 3-digit number, such that the number xyz = x^3 + y^3 + z^3
e.g. 153 is a narcissistic number of order 3 as 1^3 + 5^3 + 3^3 is equal to 153
where the ^ operator indicates raised to the power of, e.g. x^3 is x raised to the power of 3.
In Python, x**3 is used to calculate x raised to the power of 3.
![Expected program behavior:
Enter lower bound: 100
Enter upper bound: 50000
All narcissistic numbers within those bounds are:
153
370
371
407
1634
8208
9474
Hints:
• Remember the / operator - division with remainder e.g. 5/3 will give you 1.66
• Remember the // operator - division excluding remainder e.g. 5 // 3 will give you 1 instead of 1.66
• The % modulo operator can help you find the least significant digit. e.g. 127 % 10 will give you 7](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F7ef1f416-2d04-4394-95e8-8b50cbc257fd%2F3f7de9e6-0545-448e-8f33-17d1268940ab%2Frasreq_processed.png&w=3840&q=75)
![](/static/compass_v2/shared-icons/check-mark.png)
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 2 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
![C How to Program (8th Edition)](https://www.bartleby.com/isbn_cover_images/9780133976892/9780133976892_smallCoverImage.gif)
![Database Systems: Design, Implementation, & Manag…](https://www.bartleby.com/isbn_cover_images/9781337627900/9781337627900_smallCoverImage.gif)
![Programmable Logic Controllers](https://www.bartleby.com/isbn_cover_images/9780073373843/9780073373843_smallCoverImage.gif)