Advertisement
GamerBhai02

APP Exp 6

Apr 3rd, 2025
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.00 KB | Source Code | 0 0
  1. import time
  2.  
  3. def sleep_pause(t):
  4.     print(f"Program will pause for {t} sec...")
  5.     time.sleep(t)
  6.     print("Execution resumed")
  7. def input_pause():
  8.     input("Press Enter key to continue:")
  9.     print("Execution resumed")
  10. def rand_pause():
  11.     import random
  12.     delay = random.randint(2,6)
  13.     print(f"Pausing execution for {delay} sec...")
  14.     time.sleep(delay)
  15.     print("Execution resumed")
  16.  
  17. while True:
  18.     print("Choose an option:")
  19.     print("1. Pause for t=3 seconds")
  20.     print("2. Pause until interaction")
  21.     print("3. Pause for random 2-6 sec...")
  22.     print("4. Exit")
  23.     choice = int(input("Enter your choice:"))
  24.     while choice!=4:
  25.         if (choice==1):
  26.             sleep_pause(3)
  27.             break
  28.         elif (choice==2):
  29.             input_pause()
  30.             break
  31.         elif (choice==3):
  32.             rand_pause()
  33.             break
  34.         else:
  35.             print("Wrong input choice!")
  36.             break
  37.     if (choice==4):
  38.         print("Exiting")
  39.         break
Tags: Exp 6
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement