Dec-12-2018, 04:44 PM
While working on this, I have it working as it should with one exception. Under the dictionary, there is two list that has 4 values instead of 2 values. When I run the program it isn't printing the right values together for just those two year. I have messed with this for days and can't seem to figure out how to get it to print correctly.
movies = {2005: ['Munich', 'Steven Spielberg'], 2006: ['The Prestige', 'Christopher Nolan', 'The Departed', 'Martin Scorsese'], 2007: ['Into the Wild', 'Sean Penn'], 2008: ['The Dark Knight', 'Christopher Nolan'], 2009: ['Mary and Max', 'Adam Elliot'], 2010: ['The King\'s Speech', 'Tom Hooper'], 2011: ['The Artist', 'Michel Hazanavicius', 'The Help', 'Tate Taylor'], 2012: ['Argo', 'Ben Affleck'], 2013: ['12 Years a Slave', 'Steve McQueen'], 2014: ['Birdman', 'Alejandro G. Inarritu'], 2015: ['Spotlight', 'Tom McCarthy'], 2016: ['The BFG', 'Steven Spielberg']} options = input('Choose a sort option: \n') title_list = [] if options == 't': for key in movies: i = 0 while i < len(movies[key]): title_list.append(movies[key][i]) i += 2 set_title = sorted(set(title_list)) for title in set_title: print('%s:' % title) for year, value in sorted(movies.items()): if title in value: print('\t%s, %s' % (value[value.index(title)-1], year)) print()