<jupyter_start><jupyter_text>BusThis bus has a passenger entry and exit control system to monitor the number of occupants it carries and thus detect when there is too high a capacity.At each stop the entry and exit of passengers is represented by a tuple consisting of two integer numbers.```bus_stop = (in, out)```The succession of stops is represented by a list of these tuples.```stops = [(in1, out1), (in2, out2), (in3, out3), (in4, out4)]``` Goals:* lists, tuples* while/for loops* minimum, maximum, length* average, standard deviation Tasks1. Calculate the number of stops.2. Assign to a variable a list whose elements are the number of passengers at each stop (in-out),3. Find the maximum occupation of the bus.4. Calculate the average occupation. And the standard deviation.<jupyter_code># variables
stops = [(1, 1), (2, 2), (3, 3), (4, 4)]
enter = (1, 2, 3, 4) 
exit = (1, 2, 3 ,4)
total_stops = 0
passengers = []
maxpass = 0 
averagepass = 0 
stdpass = 0

# 1. Calculate the number of stops.
for i in range(len(stops)):
    total_stops += 1 
print(total_stops)

# 2. Assign a variable a list whose elements are the number of passengers in each stop: 
# Each item depends on the previous item in the list + in - out.
for i in range(len(stops)):
    passengers.append((stops[i][0]) - (stops[i][1]))
print(passengers)

# 3. Find the maximum occupation of the bus.
max(passengers)
# 4. Calculate the average occupation. And the standard deviation.
import statistics as s
s.mean(passengers)
s.stdev(passengers)<jupyter_output><empty_output>
StarcoderdataJupyterStructuredCleanDedup