+ 1
Hi! Could y'all please tell me what exactly wrong with my code is? I don't get it:(
Count=0 sum=0 while 1: num1=int(input("Enter the number") if num1==-99: break mod=num1%10 m=num1 while num1>0: If num1%10 !=mod: break num1//=10 if num1==0: count+=1 sum+=m print(m) if count>0: print(sum/count)
2 ответов
+ 1
What was the program supposed to do? find all numbers having all its digits equal to <mod>?
+ 1
Patt it's a little hard to decipher your intended logic. A description would help. Despite that, I assume you did not intend to have an infinite loop:
while num1>0:
If num1%10 !=mod:
break
Since num1 never changes inside the loop, it runs forever. If you indent the next line, it might be closer to what you wanted:
while num1>0:
If num1%10 !=mod:
break
num1//=10