Jan-03-2020, 09:31 AM
(This post was last modified: Jan-03-2020, 09:31 AM by Killertjuh.)
import time import winsound # User Input def choose(): # With a function you have to return your multi var user = 'yes' plan = input("What Your Plan For Today? : ").lower() times = int(input("What Number? : ")) while True: choose1 = input("Minute?Second?Hour? : ").lower() if 'hour' in choose1: multi = times * 3600 break # You dont have to break just use return because you work with function elif 'minute' in choose1: multi = times * 60 break # You dont have to break just use return because you work with function elif 'second' in choose1: multi = times break # You dont have to break just use return because you work with function else: print("Sorry Sir, There Is No Such Option") # Looping while multi > 0 or user == 'yes': # multi is not defined at this point so this will fail. print(multi) # you can put this line to linenumber #34 time.sleep(1) multi -= 1 # multi is not defined so this will fail. if multi == 0: print("Sir Its Time For You To Do Your Work And Have Nice Day! :)") winsound.PlaySound('C:\\Users\\user\\Documents\\All About Python3 Or Programming\\All Project With Python 3\\background.wav', winsound.SND_FILENAME) user = input("Do You Want To Make More Plans? : ").lower() if user == 'yes': choose() else: user = 'no'I hope this quick change works for you. I`ll didnt test this one.
import time import winsound # User Input def choose(): user = 'yes' plan = input("What Your Plan For Today? : ").lower() times = int(input("What Number? : ")) while True: choose1 = input("Minute?Second?Hour? : ").lower() if 'hour' in choose1: return times * 3600 elif 'minute' in choose1: return times * 60 elif 'second' in choose1: return times else: print("Sorry Sir, There Is No Such Option") # Looping multi = 0 while True: time.sleep(1) if multi == 0: print("Sir Its Time For You To Do Your Work And Have Nice Day! :)") winsound.PlaySound('C:\\Users\\user\\Documents\\All About Python3 Or Programming\\All Project With Python 3\\background.wav', winsound.SND_FILENAME) user = input("Do You Want To Make More Plans? : ").lower() if user == 'yes': multi = choose() print(multi) else: user = 'no' # exit() else: if isinstance(multi, int): multi -= 1