Exactly k non zero digits | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
+ 1

Exactly k non zero digits

program must print the integers from x to y having exactly k non zero digits x,y,k=map(int,input().split()) for i in range(x,y+1): while i>0: count=0 a=i%10 if a!=0: count+=1 i=i//10 if count==k: print(i,end=' ') Input: 100 200 2 expected output: 101 102 103 104 105 106 107 108 109 110 120 130 140 150 160 170 180 190 but I am not getting any output Is my code correct?

14th Jun 2020, 8:54 AM
VARSHA
5 Respostas
0
šŠš¢š¢š›šØ š†š”ššš²ššš„ Great , the above code passed Many thanks for helping me outā˜ŗļøā˜ŗļø
14th Jun 2020, 9:41 AM
VARSHA
0
Is my logic correct there? šŸ¤”šŸ¤”šŸ¤” I'm very confused šŠš¢š¢š›šØ š†š”ššš²ššš„
14th Jun 2020, 9:44 AM
VARSHA
14th Jun 2020, 9:57 AM
VARSHA