How to Pause a Program in Python


If you need to pause the execution of your Python program, then you can do the following:

Option 1 – Using time.sleep()

import time

time_duration = 3.5
time.sleep(time_duration)

Option 2 – Using input()

name = input("Please enter your name: ")
print("Name:", name)

Option 3 – Using os.system("pause")

import os

os.system("pause")