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 |
|---|---|---|---|---|---|---|
| Mon1 | 0 | 1 | 0 | 0 | 3 | 4 |
| Tue1 | -3 | 1 | 1 | 0 | 3 | 3 |
| Wed1 | 5 | 3 | 6 | -4 | 1 | 0 |
| Thu1 | 2 | 2 | 2 | -7 | 0 | 0 |
| Fri1 | 0 | 1 | 4 | -9 | 1 | 0 |
| Mon2 | 0 | 2 | 0 | 0 | 1 | 0 |
| Tue2 | -3 | 5 | 0 | 0 | -5 | 0 |
| Wed2 | 1 | -1 | 0 | 0 | -3 | -1 |
| Thu2 | 1 | -2 | 5 | 0 | 0 | -4 |
| Fri2 | 1 | 7 | 0 | 0 | 0 | -7 |
| Mon3 | -4 | 5 | -4 | 0 | 0 | -9 |
| Tue3 | 5 | 6 | 0 | -3 | 0 | 0 |
| Wed3 | 2 | 3 | 0 | -1 | 0 | 0 |
| Thu3 | 4 | 0 | 0 | -3 | 0 | 0 |
| Fri3 | 1 | 0 | 3 | 6 | 0 | 0 |
| Mon4 | 4 | 0 | 7 | 3 | -6 | 0 |
| Tue4 | 2 | 0 | 3 | 5 | -3 | 4 |
| Wed4 | 4 | -1 | 6 | 0 | 7 | 2 |
| Thu4 | 2 | -4 | 4 | 0 | 4 | 1 |
| Fri4 | 5 | -2 | 0 | 0 | 5 | 0 |
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.
For each bus route, calculate and display the following statistics:
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
You have completed Part B of this coding challenge.
Submit your work as instructed.
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.