Question: python questions First Last BlockPy: #40.1) Genre Courts The code below is rmieant to count the number of times each genre appears in the list
First Last BlockPy: #40.1) Genre Courts The code below is rmieant to count the number of times each genre appears in the list below. However, the code has some critical errors. Fix the code so that it correctly counts genres and prints the result Feedback: Ready Console I: Blocks Split | / Text | Reset Upload History Run books,genres ["Horror", "Sci-F1", "Horror", "Comedy", Conedy","Horror""Horror",Comedy" genre, counts O for genre in books genres: if genre in genre counts: genre_countsl"genre"] -genre_countsl"genre"]+1 else: genre counts genre"] - 1 print (genre counts)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
