Page 1 of 1

use Python! please help

Posted: Fri Jul 01, 2022 5:41 am
by answerhappygod
use Python! please help
Use Python Please Help 1
Use Python Please Help 1 (19.66 KiB) Viewed 44 times
Use Python Please Help 2
Use Python Please Help 2 (149.73 KiB) Viewed 44 times
Movie data Spider-Man: No Way Home Action Jon Watts Top Gun: Maverick Action Joseph Kosinski Bubble Animation Tetsuro Araki Lightyear Animation Angus MacLane Oblivion Science Fiction Joseph Kosinski The Northman Action Robert Eggers Jurassic World Dominion Science Fiction Colin Trevorrow The Valet Comedy Richard Wong The Bad Guys Comedy Pierre Perifel Morbius Science Fiction Daniel Espinosa Doctor Strange in the Multiverse of Madness Fantasy Sam Raimi Hustle Comedy Jeremiah Zagar Interceptor Action Matthew Reilly
Function Name: sortByGenre() Parameters: filename (str), genre (str), output filename (str) Returns: None (NoneType ) Description: You've been given a data book of movies, their genres, and the director who directed them. To make things easier to find in the data book, you decide to filter the movies according to their genres. You've also decided to sort the movie names alphabetically to make them even easier to find. Given a file name to a file that contains all the movie data and a genre, write all the sorted data for the specified genre to a file (with the given output filename) in the following format: Genre 1. Movie name- Director 2. Movie name- Director >>> sortByGenre('movies.txt', 'Action', 'movie ByGenres.txt') The resulting file (movieByGenres.txt) should NOT have an extra '\n' at the end. Action 1. Interceptor - Matthew Reilly 2. Spider-Man: No Way Home - Jon Watts 3. The Northman - Robert Eggers 4. Top Gun: Maverick - Joseph Kosinski Note: If the genre does not exist in the movies file, your output file should be in the following format: Genre