File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed
Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -82,10 +82,13 @@ def get_user_input():
8282 num_servers = input ("Input # of servers working: " )
8383 num_ushers = input ("Input # of ushers working: " )
8484 params = [num_cashiers , num_servers , num_ushers ]
85- try :
85+ if all ( str ( i ). isdigit () for i in params ): # Check input is valid
8686 params = [int (x ) for x in params ]
87- except :
88- print ("Could not parse input. The simulation will use default values." )
87+ else :
88+ print (
89+ "Could not parse input. The simulation will use default values:" ,
90+ "\n 1 cashier, 1 server, 1 usher." ,
91+ )
8992 params = [1 , 1 , 1 ]
9093 return params
9194
@@ -102,7 +105,10 @@ def main():
102105
103106 # View the results
104107 mins , secs = calculate_wait_time (arrival_times , departure_times )
105- print (f"The average wait time is { mins } minutes and { secs } seconds." )
108+ print (
109+ "Running simulation..." ,
110+ f"\n The average wait time is { mins } minutes and { secs } seconds." ,
111+ )
106112
107113
108114if __name__ == "__main__" :
You can’t perform that action at this time.
0 commit comments