• API
• FAQ
• Tools
• Trends
• Archive
daily pastebin goal
67%
SHARE
TWEET

# fuckme

MORGATRON16 Aug 13th, 2017 65 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
1. def route_fun():
2.   while True:
3.     try:
4.       route = input ("Please enter the route number: ")
5.       route = int (route)
6.     except ValueError:
7.         print ("Invalid route number. Please enter a positive integer.")
8.         continue
9.     if route < 1:
10.         print("Invalid route number. Please enter a positive integer.")
11.         continue
12.     else:
13.       break
14.
15. def stop_fun():
16.   while True:
17.     try:
18.       stop = input ("Please enter the number of stops on this route: ")
19.       stop = int(stop)
20.     except ValueError:
21.       print ("Invalid number of stops. Please enter a positive integer.")
22.       continue
23.     if stop < 1:
24.         print("Invalid number of stops. Please enter a positive integer.")
25.         continue
26.     if stop == 1:
27.         print("Invalid number of stops. There must be at least two stops on the route.")
28.         continue
29.     else:
30.       break
31.
32. for _ in range (int(stop)):
33.   waiting_fun()
34.   left_fun()
35.
36. def waiting_fun():
37.   while True:
38.     try:
39.       passengers_waiting = input ("How many passengers were waiting for the bus at stop #1?")
40.       passengers_waiting = int(passengers_waiting)
41.     except ValueError:
42.       print("Invalid number of passengers. Please enter a non-negative integer.")
43.       continue
44.     if passengers_waiting < 0:
45.       print("Invalid number of passengers. Please enter a non-negative integer.")
46.       continue
47.     else:
48.       break
49.
50. def left_fun():
51.   while True:
52.     try:
53.       passengers_left = input ("How many passengers left the bus at stop #2?")
54.       passengers_left = int(passengers_left)
55.     except ValueError:
56.       print("Invalid number of passengers. Please enter a non-negative integer.")
57.       continue
58.     if passengers_left < 0:
59.       print ("Invalid number of passengers. Please enter a non-negative integer.")
60.       continue
61.     else:
62.       break
63.
64.
65. print ("Route number:" ,route,"")
66. print ("Happy customers: ",passengers_waiting,"")
67. print ("Unhappy customers: ",passengers_left,"")
68. print ("Ratio of happy to unhappy customers: ")
RAW Paste Data
Top