Question
PYTHON We set up a project to count the number of cars passing my front yard each hour. A snippet of the data looks like
PYTHON
We set up a project to count the number of cars passing my front yard each hour.
A snippet of the data looks like this:
data = [ (2,"12/21/2017 21:30"), (8,"12/21/2017 22:30"), (1,"12/22/2017 00:30"), (1,"12/22/2017 01:30"), . . . (8,"12/31/2017 21:30"), (1,"12/31/2017 22:30"), ]
There is a list element for each day and hour combination, and the elements of that list are a tuple that pairs the number of cars with the date and time. The whole list is contained within the square brackets [ and ], and each tuple appears within parentheses, ( and ).
Your task is to code a bit of Python to iterate through the data provided, and draw a text-mode bar chart with lines like this:
12/31/2017 01:30 * 12/31/2017 09:30 ****** 12/31/2017 10:30 ********** 12/31/2017 11:30 **************
Of course yours will have many more lines, but each line will look similar to this: the date and time string, followed by a space, followed by the number of asterisks corresponding to the count in the tuple for that date time.
The py file is linked below with the data:
https://drive.google.com/file/d/1E8SNQTZL9C8rNXiqiskgfZz0aA3c4zNE/view?usp=sharing
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