Question: Q 1 ) [ 4 points ] Download the data file named question 1 . txt from the Exam Submission on Blackboard ( simply right

Q1)[4 points] Download the data file named question1.txt from the Exam Submission on Blackboard (simply right-click on the file name and choose 'Save link as ...' and browse to your GENG106_F23 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
q1.py 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 TV_shows 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:
n, which is the total number of the given TV shows.
m avg which is the average of views i.e. the sum of views divided by n
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 =[20,40,60,80,100]
g. Add the following list to your main() function: user_atings =[5,4,12,10,15] Using matplotlib.pyplot, create a bar graph of bins versus user_ratings. 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
q1.py source code and paste it in a My_Solutions 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 My_Solutions.
Save your Word document and move to the next question.
1
Q 1 ) [ 4 points ] Download the data file named

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!