I'm kinda stuck on this homework assignment and i need help. this program has a menu but i got all the menu except this part. this menu selection is asking the user input for the category and going thought the list then print out the movie year and name that contain the category.example of dictionary/ [year,"name", "category"] and the dictionary name is movieDictionary:I need help on the red text
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
movies = [[ 1939 , "Gone With the Wind" , "drama" ], [ 1943 , "Casablanca" , "drama" ], [ 1965 , "The Sound of Music" , "musical" ], [ 1969 , "Midnight Cowboy" , "drama" ], [ 1972 , "The Godfather" , "drama" ], [ 1973 , "The Sting" , "comedy" ], [ 1977 , "Annie Hall" , "comedy" ], [ 1982 , "Gandhi" , "historical" ], [ 1986 , "Platoon" , "action" ], [ 1990 , "Dances with Wolves" , "western" ], [ 1992 , "Unforgiven" , "western" ], [ 1994 , "Forrest Gump" , "comedy" ], [ 1995 , "Braveheart" , "historical" ], [ 1997 , "Titanic" , "historical" ], [ 1998 , "Shakespeare in Love" , "comedy" ], [ 2000 , "Gladiator" , "action" ], [ 2001 , "A Beautiful Mind" , "historical" ], [ 2002 , "Chicago" , "musical" ], [ 2009 , "The Hurt Locker" , "action" ], [ 2010 , "The Kings Speech" , "historical" ], [ 2011 , "The Artist" , "comedy" ], [ 2012 , "Argo" , "historical" ], [ 2013 , "12 Years a Slave" , "drama" ], [ 2014 , "Birdman" , "comedy" ], [ 2016 , "Moonlight" , "drama" ], [ 2017 , "The Shape of Water" , "fantasy" ], [ 2020 , "Parasite" , "drama" ]] movieDictionary = {} for movie in movies: year = movie[ 0 ] movieDictionary[year] = [movie[ 1 ],movie[ 2 ]] elif option = = "pc" : category = input ( "Enter category: " ) if category in "action, drama, musical, comedy, historical, western, fantasy " : for movie in movieDictionary: output4 = [] output4 = movieDictionary if output4[ 1 ] = = category: print (movie, "," ,output[ 0 ], "," ,output[ 1 ]) |