Code:
import csv #importing csv module
top_movies = open("top_movies.csv") #opening csv file in read mode
csv_reader = csv.DictReader(top_movies) #getting the DictReader object
#DictReader object yields every row as a dictionary so that you can access
#values of the row by using their column headings
#One thing to be noted is while writing the headings of csv files there must
#be no spaces before or after "," . And if spaces are there then the heading
#also includes spaces so then the key of dictionary also adds spaces
#so avoid common mistake of writing spaces before and after "," while
#separating values in csv file.
genres = [] #list to store the genres
counts = [] #list to store the counts of respective genres
for row in csv_reader: #for every row in the csv file
if row["genre"] not in genres: #if a genre is not in genres list
genres.append(row["genre"]) #appending it to genres list
counts.append(0) #and also appending 0 to store count
index = genres.index(row["genre"]) #gets the index of genre in genres list
counts[index] += 1 #and a count of 1 is added to that respective index
for i in range(len(genres)): #printing all genres and their counts
print("Genre:", genres[i], "- Quantity:", counts[i])
Code Screenshot:
Output:

top_moves.csv:

Each and everything is explained clearly in the comment section of the code.
Thank you! Hit like if you like my work.
how would i do this? thanks Download the following file: top series.csv Move it to Python...
Need a program in python.
Asterix and Obelix want to store and process information about
movies they are interested in. So, you have been commissioned to
write a program in Python to automate this. Since they are not very
computer literate, your program must be easy for them to use. They
want to store the information in a comma separated text file. Using
this they would need to generate a report – see all items AND show
a bar chart...
Download the library.xml file. The root
element is CATALOG and contains a series of BOOK
elements, each of which represents a single BOOK. Each
BOOK element has a number of child elements such as
AUTHOR, TITLE, GENRE, PRICE and so on.
Python Language 3.8
Add comments for each line
Thank you
Write a program to read the file and print out the following
information with an appropriate message:
1. (40 points) Write a function called
display_book that prints the title,...
Here is the database file: -------------------------moviedatabase.sql------------------------- INSERT INTO artists (`artist_id`,`first_name`,`last_name`,`contact_no`,`Profession`,`birth date`,`address`) VALUES (1,'Idrissa Akuna ','Elba','4706091972','Actor','1972-09-06 00:00:00','CA'); INSERT INTO artists (`artist_id`,`first_name`,`last_name`,`contact_no`,`Profession`,`birth date`,`address`) VALUES (2,'Christopher Hemsworth','Hemsworth','3408111983','Actor','1983-08-11 00:00:00','IL'); INSERT INTO artists (`artist_id`,`first_name`,`last_name`,`contact_no`,`Profession`,`birth date`,`address`) VALUES (3,'Zoe ','Saldana','4106191978','Actor','1978-06-19 00:00:00','AZ'); INSERT INTO artists (`artist_id`,`first_name`,`last_name`,`contact_no`,`Profession`,`birth date`,`address`) VALUES (4,'Christopher','Townsend','3903251976','Visual Effects','1976-03-25 00:00:00',NULL); INSERT INTO artists (`artist_id`,`first_name`,`last_name`,`contact_no`,`Profession`,`birth date`,`address`) VALUES (5,'Guy','Williams','3209211985','Reviewer','1985-09-21 00:00:00',NULL); INSERT INTO artists (`artist_id`,`first_name`,`last_name`,`contact_no`,`Profession`,`birth date`,`address`) VALUES (6,'Jonathan','Fawkner','3011131990','Reviewer','1990-11-13 00:00:00',NULL); INSERT INTO artists (`artist_id`,`first_name`,`last_name`,`contact_no`,`Profession`,`birth date`,`address`) VALUES (7,'Dan','Sudick','4701201972','Visual Effects','1972-01-20 00:00:00','NJ'); INSERT INTO artists (`artist_id`,`first_name`,`last_name`,`contact_no`,`Profession`,`birth date`,`address`) VALUES (8,'Tom','Holland','2401061996','Actor','1996-06-01 00:00:00','CA'); INSERT INTO artists (`artist_id`,`first_name`,`last_name`,`contact_no`,`Profession`,`birth...
You need not run Python programs on a computer in solving the following problems. Place your answers into separate "text" files using the names indicated on each problem. Please create your text files using the same text editor that you use for your .py files. Answer submitted in another file format such as .doc, .pages, .rtf, or.pdf will lose least one point per problem! [1] 3 points Use file math.txt What is the precise output from the following code? bar...