Question
given a list: [ [80058654, 'TV Show', 'Transformers: Robots in Disguise', None, 'Will Friedle, Darren Criss, Constance Zimmer, Khary Payton, Mitchell Whitfield, Stuart Allan, Ted
given a list:
[ [80058654, 'TV Show', 'Transformers: Robots in Disguise', None, 'Will Friedle, Darren Criss, Constance Zimmer, Khary Payton, Mitchell Whitfield, Stuart Allan, Ted McGinley, Peter Cullen', 'United States', '09-08-2018', 2016, "Kids' TV", 'When a prison ship crash unleashes hundreds of Decepticons on Earth, Bumblebee leads a new Autobot force to protect humankind.'] , [70299204, 'Movie', 'Kidnapping Mr. Heineken', 'Daniel Alfredson', 'Jim Sturgess, Sam Worthington, Ryan Kwanten, Anthony Hopkins, Mark van Eeuwen, Thomas Cocquerel, Jemima West, David Dencik', 'Netherlands, Belgium, United Kingdom, United States', '09-08-2017', 2015, 'Action & Adventure, Dramas, International Movies', 'When beer magnate Alfred "Freddy" Heineken is kidnapped in 1983, his abductors make the largest ransom demand in history.'], ...]
Write a python function that take in the given list and takes in a letter and scans through all of the descriptions of movies/TV which are the last string of each sublists, You should create a list of tuples with the 0th index of the tuple being the title of the movie/TV show (str) and the 1st index of the tuple being the number of times the letter appears in the description (int). Return the top 50 results of the list sorted descending by the number of times the letter appears within the description. If 2 or more movies/TV shows have the same number of letter appearances, you should further sort them by title alphabetically descending the title are the third elements of each sublists. Capitalization of the letter parameter and the description does not matter.
as follow:
[ ('The Ultimatum', 7), ('Women of Mafia 2', 5), ('Rosario Tijeras', 5), ('Off Camera', 5), ('Lila & Eve', 5), ('Kiss the Girls', 5), ..., ('Tales by Light', 3), ('Star Trek', 3), ('Spyder', 3), ("Slobby's World", 3), ('Shrek the Musical', 3) ]
note that the list is long and could not be entirely copied here but assumed that every sublists have the same elements as the one given up
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started