Answer to Question #320496 in Python for lokesh

Question #320496

Armstrong number between two intervals


1
Expert's answer
2022-03-29T16:48:25-0400
n1 = int(input('start: '))
n2 = int(input('end: '))
for i in range(n1,n2+1):
	p = len(str(i))
	s = 0
	for d in str(i):
		s += int(d)**p
	if s == i:
		print(i)

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS