current = 1 # This is the current factorial i = 1 # This is the loop counter while current < 1000000000: i += 1 current *= i print(i-1) # Another way: A counting loop that stops # continue: Go on to the next iteration # break: Stop the loop current = 1 for i in range(1, 1000): current *= i if current > 1000000000000: break print(i-1)