def four(n): if n - 4 != 0: if n % 10 == 0: four(n//10) #break elif n % 10 == 4: four(n//10) # break else: four(n*2) print(n, end=" -> ") print("4 -> ", end = "") four(147)
Standard input is empty
4 -> 2 -> 1 -> 14 -> 144 -> 72 -> 36 -> 18 -> 184 -> 92 -> 46 -> 464 -> 232 -> 116 -> 58 -> 29 -> 294 -> 147 ->