Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import time
- def sleep_pause(t):
- print(f"Program will pause for {t} sec...")
- time.sleep(t)
- print("Execution resumed")
- def input_pause():
- input("Press Enter key to continue:")
- print("Execution resumed")
- def rand_pause():
- import random
- delay = random.randint(2,6)
- print(f"Pausing execution for {delay} sec...")
- time.sleep(delay)
- print("Execution resumed")
- while True:
- print("Choose an option:")
- print("1. Pause for t=3 seconds")
- print("2. Pause until interaction")
- print("3. Pause for random 2-6 sec...")
- print("4. Exit")
- choice = int(input("Enter your choice:"))
- while choice!=4:
- if (choice==1):
- sleep_pause(3)
- break
- elif (choice==2):
- input_pause()
- break
- elif (choice==3):
- rand_pause()
- break
- else:
- print("Wrong input choice!")
- break
- if (choice==4):
- print("Exiting")
- break
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement