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.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
100%

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
Transcribed Image Text: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
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 2 images

Blurred answer
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education