Part A

Buses - Part B

Now, there are 6 buses, labeled Bus A to Bus F.

Each bus runs from Monday to Friday.

As before, data about lateness is stored in arrays for each bus eg:

day Bus A Bus B Bus C Bus D Bus E Bus F
Mon1010034
Tue1-311033
Wed1536-410
Thu1222-700
Fri1014-910
Mon2020010
Tue2-3500-50
Wed21-100-3-1
Thu21-2500-4
Fri217000-7
Mon3-45-400-9
Tue3560-300
Wed3230-100
Thu3400-300
Fri3103600
Mon44073-60
Tue42035-34
Wed44-16072
Thu42-44041
Fri45-20050

Part A

Task 1 - setting up the data

Using arrays, design a system to allow data to be entered for each bus for each day of a 4-week period, as example above.

After data has been entered, display the information meaningfully.

Time-saving option: use a random number generator to populate the arrays. Later, you can chnage this to be user input.

Task 2 - adaptive maintenance

For each bus route, calculate and display the following statistics:

  • the number of times the bus was late
  • the number of times the bus was early
  • the number of times the bus was on time

Task 3 - Tricky Task!

Code a solution to this problem:

A user can enter a day and a week number eg Fri4 or Mon2.

The program will find and display the bus name and how many minutes the bus was late for every bus that was late on that day eg:

Enter a day code: Fri3

Buses late on that day:

Bus A: 13 minutes late

Bus E: 2 minutes late

Bus F: 9 minutes late

Complete

You have completed Part B of this coding challenge.

Submit your work as instructed.

Programming Tip

When you finish the first task, save your file as buses-1.py

Then, with task 1 still open continue on to the next task and save it as buses-2.py

Then you can create a history of your progress.