What is the python logic to check if a number is armstrong number or not?

0 votes
How is the logic different from any other programming language?
Jul 23, 2019 in Python by Waseem
• 4,530 points
62 views

1 answer to this question.

0 votes
number = int(input("enter a number"))

s = 0
temp = number
while temp > 0:
     c = temp % 10
     s += c**3
     temp //= 10
if temp ==  num:
   print('armstron number')
else:
   print('not an armstrong number')  
answered Jul 30, 2019 by Mohammad
• 3,230 points

Related Questions In Python

0 votes
0 answers

What is the logic to check if a number is prime or not in python?

I am looking for a function with ...READ MORE

Aug 2, 2019 in Python by Waseem
• 4,530 points
51 views
0 votes
2 answers

Check a number is Prime or not in Python

There is an efficient way to write ...READ MORE

answered Oct 26, 2018 in Python by Priyaj
• 57,530 points
753 views
0 votes
1 answer

How to print a message or the error if a file is not found?

To print the message that file is not ...READ MORE

answered Jan 2, 2019 in Python by Omkar
• 69,060 points
92 views
0 votes
1 answer

How do I check if input string is a valid regular expression or not in Python?

Hi. Good question! Well, just like what ...READ MORE

answered Feb 12, 2019 in Python by Nymeria
• 3,540 points
2,523 views
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 6, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 933 views
0 votes
0 answers
+4 votes
6 answers
0 votes
2 answers

what is the procedure to the version of python in my computer?

Execute the following command on your terminal: python ...READ MORE

answered Mar 19, 2019 in Python by Alia
125 views
0 votes
1 answer

What is the best IDE for python to work in linux?

Pycharm ranks the best python ide to ...READ MORE

answered Aug 19, 2019 in Python by Mohammad
• 3,230 points
55 views