Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Question 5 An 8-year-old boy, Billy Bells, wanted to brush up on his counting skills so he decided to go to a 5-level parking garage
Question 5 An 8-year-old boy, Billy Bells, wanted to brush up on his counting skills so he decided to go to a 5-level parking garage and, at each level, he started to count the number of red cars, blue cars, black cars and white cars at that level. He also made a note of the total number of cars, of those four colours, at that level. When Billy reached the top he also noted the total number of cars of those four colours that he'd seen over all five levels of the parking garage. Write a Python program to help Billy Bells keep track of and report the level number (1 to 5 ) along with the total number of cars (including all four colours) parked at that level and the total number of cars (including all four colours) parked in the entire garage. In addition, keep track of and report the total number of cars of each colour parked in the entire garage. Billy will tell you the colour of each car he sees at each level (some cars may be a colour other than the four listed colours, ignore these). When he is done with a level, he will say "DONE". Your solution should make use of nested loops. Call the file containing your program car_counting.py. Sample input/output (user sample input shown in bold blue): Enter the colour of a car on Level 1: red Enter the colour of a car on Level 1: blue Enter the colour of a car on Level 1: blue Enter the colour of a car on Level 1: done Total number of the 4-colours cars on level 1 is 3 Enter the colour of a car on Level 2: orange Enter the colour of a car on Level 2: blue Enter the colour of a car on Level 2: black Enter the colour of a car on Level 2: white Enter the colour of a car on Level 2: white Enter the colour of a car on Level 2: done Total number of the 4-colours cars on level 2 is 4 Enter the colour of a car on Level 3: red Enter the colour of a car on Level 3: red Enter the colour of a car on Level 3: green Enter the colour of a car on Level 3: done Total number of the 4-colours cars on level 3 is 2 Enter the colour of a car on Level 4: purple Enter the colour of a car on Level 4: done Total number of the 4-colours cars on level 4 is 0 Enter the colour of a car on Level 5: white Enter the colour of a car on Level 5: red Enter the colour of a car on Level 5: done Total number of the 4-colours cars on level 5 is 2 Total number of red cars in the garage: 4 Total number of blue cars in the garage: 3
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started