Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Need to know how to make program for armstrong number. I have everything working

ID: 3542507 • Letter: N

Question

Need to know how to make program for armstrong number. I have everything working EXCEPT for my elif statement i need the person to know when using my program that the number they select CANNOT be less than or more than 3 digits. My elif statement is not working at all. Here is what i have so far

print"""
    ==========================
    Is it an Armstrong number?
    --------------------------"""

#Input
your_number = input("Enter your three digit number: ")

#Processing
first_digit = your_number / 100
remainder = your_number % 100
second_digit = remainder / 10
third_digit = remainder % 10

#Output
if your_number == first_digit ** 3 + second_digit ** 3 + third_digit ** 3:
    print your_number, "is an Armstrong Number"

elif  999 < your_number < 0:
     print"""This program only tells if the number you chose is an armstrong
number if it is three digits"""

else:
    print"I'm afraid", your_number, "is NOT an Armstrong Number."
   

done = raw_input("Press enter to exit.")

Explanation / Answer

print"""

==========================

Is it an Armstrong number?

--------------------------"""

#Input

your_number = int(raw_input("Enter your three digit number: "))

#Processing

first_digit = your_number / 100

remainder = your_number % 100

second_digit = remainder / 10

third_digit = remainder % 10

#Output

if (your_number>999 or your_number<100):

print"""This program only tells if the number you chose is an armstrong number if it has three digits"""

elif your_number == first_digit ** 3 + second_digit ** 3 + third_digit ** 3:

print your_number, "is an Armstrong Number"

else:

print"I'm afraid", your_number, "is NOT an Armstrong Number."

done = raw_input("Press enter to exit.")

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote