Problem description
Write a program that will calculate and display statistics of Broadway shows where the data comes from a comma-separated values (CSV) file. We will use the reader function from the csv module as seen in class that places the data from the CSV file into a list that can then be processed. The CSV file that will be used for this exercise is called boardway.csv and can be downloaded below. The first line of the file contains the names for each type of data stored in the subsequent lines. Each of the remaining lines represents a week’s worth of data for a specific Broadway show. The date range of the data is from 2010 to 2016. The CSV file contains more than 10,000 lines, so it is a fairly large dataset. We will not be using all of the data available, but rather we will be specifically interested in the following data items: month, year, name of show, attendance totals, revenue totals, and performance totals. For this exercise, the program should ask three things from the user: 1) what type of stats does the user want to view, 2) the name of the show of interest, and 3) the year of interest. The type of stats include attendance, revenue, and number of performances. Once this information is obtained, the program should calculate the stats for the show and year of interest. This will include stats that are separated by each month of the year and then at the end the sum of the totals of each of the months. Once the stats has been printed, the program should terminate.
As seen in class, after the reader function in the csv module has been called and the result stored in a variable, a loop can be used to iterate over the CSV object stored in that variable. Also, as seen in class, in one iteration of the loop, the loop variable will contain a list representing one of the lines of the CSV file, where each element of the list represents the data that was separated by commas. For example, consider the second line in the file: “3”:1/3/2010″:1″:2010″:A Little Night Music”:Walter Kerrs:Musicar:7527″:101″:10315437112″:8″ The list that will be generated for this line will look something like the following. This represents one line in the CSV file.
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Phasellus hendrerit. Pellentesque aliquet nibh nec urna. In nisi neque, aliquet vel, dapibus id, mattis vel, nisi. Sed pretium, ligula sollicitudin laoreet viverra, tortor libero sodales leo, eget blandit nunc tortor eu nibh. Nullam mollis. Ut justo. Suspendisse potenti.
Sed egestas, ante et vulputate volutpat, eros pede semper est, vitae luctus metus libero eu augue. Morbi purus libero, faucibus adipiscing, commodo quis, gravida id, est. Sed lectus. Praesent elementum hendrerit tortor. Sed semper lorem at felis. Vestibulum volutpat, lacus a ultrices sagittis, mi neque euismod dui, eu pulvinar nunc sapien ornare nisl. Phasellus pede arcu, dapibus eu, fermentum et, dapibus sed, urna.
Morbi interdum mollis sapien. Sed ac risus. Phasellus lacinia, magna a ullamcorper laoreet, lectus arcu pulvinar risus, vitae facilisis libero dolor a purus. Sed vel lacus. Mauris nibh felis, adipiscing varius, adipiscing in, lacinia vel, tellus. Suspendisse ac urna. Etiam pellentesque mauris ut lectus. Nunc tellus ante, mattis eget, gravida vitae, ultricies ac, leo. Integer leo pede, ornare a, lacinia eu, vulputate vel, nisl.
Suspendisse mauris. Fusce accumsan mollis eros. Pellentesque a diam sit amet mi ullamcorper vehicula. Integer adipiscing risus a sem. Nullam quis massa sit amet nibh viverra malesuada. Nunc sem lacus, accumsan quis, faucibus non, congue vel, arcu. Ut scelerisque hendrerit tellus. Integer sagittis. Vivamus a mauris eget arcu gravida tristique. Nunc iaculis mi in ante. Vivamus imperdiet nibh feugiat est.
Ut convallis, sem sit amet interdum consectetuer, odio augue aliquam leo, nec dapibus tortor nibh sed augue. Integer eu magna sit amet metus fermentum posuere. Morbi sit amet nulla sed dolor elementum imperdiet. Quisque fermentum. Cum sociis natoque penatibus et magnis xdis parturient montes, nascetur ridiculus mus. Pellentesque adipiscing eros ut libero. Ut condimentum mi vel tellus. Suspendisse laoreet. Fusce ut est sed dolor gravida convallis. Morbi vitae ante. Vivamus ultrices luctus nunc. Suspendisse et dolor. Etiam dignissim. Proin malesuada adipiscing lacus. Donec metus. Curabitur gravida