- 2

Why code is not running? Please anyone give me full solution 😭

i=int(input("enter number ")) sum=0 a=i while (i>0): rem=i%10 sum+=rem ** 3 i//10 if a==sum: print("this is a armstong no") else: print("number is not Armstrong no")

11th Sep 2022, 12:44 PM
Sachin Patel
Sachin Patel - avatar
3 ответов
+ 3
Please don't keep posting the same thing. https://www.sololearn.com/discuss/3082819/?ref=app
11th Sep 2022, 1:06 PM
Ausgrindtube
Ausgrindtube - avatar
+ 2
as you never change the value of "i" inside of the loop, it will be an infinite loop if your input is anything > 0...
11th Sep 2022, 12:49 PM
Lisa
Lisa - avatar
0
I//10 no use. It should be like i = i//10 or i //= 10 #short form. And put if-else block after loop. Not inside. If you are trying this in code coach, then your output should match with expected output, with no more or less character in the output..
11th Sep 2022, 1:08 PM
Jayakrishna 🇮🇳