Steps =  a,b = input().split(' ') a,b = [int(a),int(b)] while True: try : steps = 0 if a % b == 0 : Steps +=  else : while a % b != 0 : a = a + 1 steps += 1 Steps += [steps] except ValueError : pass for i in Steps : print(i)
well in this code I trie to solve this problem : Problem - 1328A - Codeforces
but the issue is that I didn’t found a way to stop the loop when the input is finished, If you took a look at the problem, you’ll find that the input is something like that :
and the output should be :
I can for example stop the loop, by using break() if a is divisible by b, but this is not correct for every case…
All in all, I need a way to stop the loop just after the input is finished.