fork download
  1. def four(n):
  2.  
  3. if n - 4 != 0:
  4.  
  5. if n % 10 == 0:
  6. four(n//10)
  7. #break
  8. elif n % 10 == 4:
  9. four(n//10)
  10. # break
  11. else:
  12. four(n*2)
  13. print(n, end=" -> ")
  14.  
  15. print("4 -> ", end = "")
  16. four(147)
Success #stdin #stdout 0.02s 8972KB
stdin
Standard input is empty
stdout
4 -> 2 -> 1 -> 14 -> 144 -> 72 -> 36 -> 18 -> 184 -> 92 -> 46 -> 464 -> 232 -> 116 -> 58 -> 29 -> 294 -> 147 ->