Question: Q 1 ) [ 4 points ] Download the data file named question 1 . txt from the Exam Submission on Blackboard ( simply right
Q points Download the data file named questiontxt from the Exam Submission on Blackboard simply rightclick on the file name and choose 'Save link as and browse to your GENGF folder and save the file This file contains a code, followed by the corresponding TV show, and the number of user views. Create a new Python program named
qpy in which you define a main function. Perform the following in the main function:
a Write a program that open the input file in mode reading.
b put the contents of the input file into three lists where the code is in code list, and TVshows a list of TV shows and user views in views list.
c Use zip function to create a zipped object from three lists, and output the results to a file named output.txt
d Without using loops, find the following:
which is the total number of the given TV shows.
avg which is the average of views ie the sum of views divided by
e Print the above computed results each on a separate line, properly labeled and formatted.
f Add the following list to your main function: bins
g Add the following list to your main function: useratings Using matplotlib.pyplot, create a bar graph of bins versus userratings. Include your name and QUID as the graph title. Label the xlabel as 'Number of User Ratings' and the ylabel as bins'Frequency'.
What to submit:
Copy your
qpy source code and paste it in a MySolutions document.
Take a screen shot, making sure that all your output, including the produced graph, appear in the screen shot, and then paste it in MySolutions.
Save your Word document and move to the next question.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
