Questions Uploads

Tate Taylor

When I print this code I get ‘The Help, Tate Taylor’ printed 11 times. How do I set up a code that returns both 2011 key values??

It should read 


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

movie_collection_dict = {‘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 Kings 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’, 

}

#print(movie_collection_dict)

# Build a dictionary containing the specified movie collection

for_year = True

user_input = int(input(‘Enter a year between 2005 and 2016: ‘))

while for_year:

  if user_input<2005 or user_input>2016:

    print(‘N/A’)

  else:

    for key, value in movie_collection_dict.items():

      if value[1] == user_input:

        print(key + ‘, ‘ + (value[1]))

      for_year= False

      print(movie_collection_dict[‘2011’])

 
Looking for a Similar Assignment? Order now and Get 10% Discount! Use Coupon Code "Newclient"

Expected output (

Hi,

Please, first look at Expected output (attach file) carefully, then fix my code. It is working but there some errors need to fix.

Note: its python code.

  • Attachment 1
 
Looking for a Similar Assignment? Order now and Get 10% Discount! Use Coupon Code "Newclient"

HW.

I need help with HW.

Create a scenario that incorporates data that would use lists or dictionaries. Explain why a list or a dictionary would be more appropriate for this scenario. Be sure to provide details and examples.

 
Looking for a Similar Assignment? Order now and Get 10% Discount! Use Coupon Code "Newclient"

Jill, Allen

(1) Prompt the user for a string that contains two strings separated by a comma. (1 pt)

  • Examples of strings that can be accepted:Jill, Allen
  • Jill , Allen
  • Jill,Allen

Ex:

Enter input string: Jill, Allen

(2) Report an error if the input string does not contain a comma. Continue to prompt until a valid string is entered. Note: If the input contains a comma, then assume that the input also contains two strings. (2 pts)

Ex:

Enter input string: Jill Allen
Error: No comma in string.
Enter input string: Jill, Allen

(3) Using string splitting, extract the two words from the input string and then remove any spaces. Output the two words. (2 pts)

Ex:

Enter input string: Jill, Allen
First word: Jill
Second word: Allen

(4) Using a loop, extend the program to handle multiple lines of input. Continue until the user enters q to quit. (2 pts)

Ex:

Enter input string: Jill, Allen
First word: Jill
Second word: Allen


Enter input string: Golden , Monkey
First word: Golden
Second word: Monkey


Enter input string: Washington,DC
First word: Washington
Second word: DC


Enter input string: q

i need the code with proper spacing

 
Looking for a Similar Assignment? Order now and Get 10% Discount! Use Coupon Code "Newclient"