Q: sorting a dictionary with nested list I have a dictionary with nested lists.  I need to sort by year, title and director, and print it as
year:
   title director
etc. 

The problem I am currently having (not into the sorting yet) is that when trying to print the lists from the key, for 2006 and 2011 where there are nested lists, it prints two separate 2006 and 2011's. My code:
movie_dictionary = {
'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']]
}

# Prompt the user for a year 
year = input('Enter a year between 2005 and 2016:\n')
# Displaying the title(s) and directors(s) from that year
movie_display = movie_dictionary.get(year,'N/A')

if movie_display == 'N/A':
    print('N/A')
else:
    for movie in movie_display:
        print(movie[0],movie[1])

# Display menu
print()
print("MENU")
print("Sort by:\n"
    "y - Year\n"
    "d - Director\n"
    "t - Movie title\n"
    "q - Quit\n")

user_input = input('Choose an option:\n').lower().strip()

if user_input == 'q':
    exit()
elif user_input == 'y':
    for year, movie in sorted(movie_dictionary.items()):
        for movies, director in movie:
            print(year+':\n', str(movies), str(director))
elif user_input == 'd':
    print()
elif user_input == 't':
    print()

The output is:
Enter a year between 2005 and 2016:
The Artist, Michel Hazanavicius
The Help, Tate Taylor

MENU
Sort by:
y - Year
d - Director
t - Movie title
q - Quit

Choose an option:
2005:
 Munich Steven Spielberg,
2006:
 The Prestige Christopher Nolan,
2006:
 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
2011:
 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

I want the 2011 and 2006 to be wrapped into one with two titles. Also any recommendations on sorting?

A: Within your output loop, keep track of the year.  Only when you get a new year do you print the year header:
curr_year = -1000
for year, movie in sorted(movie_dictionary.items()):
    for movies, director in movie:
        if curr_year != year:
            print(year+':')
            curr_year = year

        print(str(movies), str(director))

Output:
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

For sorting, please follow the posting guidelines: search for "Python sorting tutorial" and see what you learn from that.

A: You can handle this with just a different structured loop
elif user_input == 'y':
    for k in movie_dictionary:
        print('{}:'.format(k))
        for i in movie_dictionary[k]:
            print('  {} {}'.format(*i))


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


With your current structure it could be a little difficult to sort by director since it exists in the same list of values as title, I think a better setup would be to have a dicitonary, with dicitonarys as values like so {'2005': {'Title': 'Munich', 'Director': 'Steven Spielberg'}} could make the process easier, goodluck!
