Question

In: Computer Science

How do you find the key that has the most vlaues in it in a dict()...

How do you find the key that has the most vlaues in it in a dict() useing python?

Example:

{'Zombies Take the Schoolyard': ['Beavers, Kim', 'Frank, Jordan', 'Goodman, Branden', 'Rivera, David', 'Stettler, Sarah'], 'Zompyres: Texas': ['Beck, Stefan', 'Bourland, Cory', 'Burnett, Chase', 'Dumas, Laura', 'Funderburk, Katie'], "2012 Dick's Oddity": ['Attix, Cathy', 'Belville, Bonnie', 'Graciela, Maritza', 'Jakus, Julia', 'Swarts, Nick'], 'CC 2010': ['Coulston, Sabrina'], 'December 21, 2012': ['Faust, Ricky', 'Keep, Tracey', 'Kehayas, Heather', 'Kimball, Elizabeth', 'Walkow, Brett'], 'Venjaxor: 2012!': ['Hueffmeier, Keith', 'Parmentier, Bill', 'Severson, Robert', 'Stroup, Kevin', 'Warner, Ron'], 'Steel of Fire Warriors 2010 A.D.': ['Clarke, Kevin', 'Furback, Jaqi', 'Sheen, Derek', 'Straw, Owen', 'Vogt, Travis']}

With these movies how do I find the the one that had the most actors in it.

Thanks for the help.

Solutions

Expert Solution

Here in dictionary for most of the we have 5 names in Values of dictionary keys. While we get d.items() method it takes key value pairs as tuples and it is checking for maximum values and gives the key.

If we have strings for keys and lists the d.items will not give values every time in the same order.If the sizes are different we will get highesh value if we have same size then we will get which value is there at first maximum index while calculating d.items()


Related Solutions

Of the Four Noble Truths, which do you find to be the most accurate in how...
Of the Four Noble Truths, which do you find to be the most accurate in how it describes reality according to your experience? Which is the least accurate? Give specific examples and explain your answers. Minimum 300 words.  
What managerial accounting concept or procedure did you find most interesting? Most challenging? How do you...
What managerial accounting concept or procedure did you find most interesting? Most challenging? How do you see yourself using managerial accounting in the future?
How do you think Wall Street has changed the most since the 1985? How do you...
How do you think Wall Street has changed the most since the 1985? How do you think it is still similar? How realistic do you think the insider trading schemes were? How widespread do you think insider trading still is today? Briefly explain. Be sure to discuss financial market regulators in your answer.
Search the Internet using the key words: "best practices, project management". What do you find? How...
Search the Internet using the key words: "best practices, project management". What do you find? How might this be useful to a team as they manage projects? PLEASE CITE YOUR SOURCES AND REFERENCES!
What key concepts are you most drawn to in SFBT? In narrative therapy? What do you...
What key concepts are you most drawn to in SFBT? In narrative therapy? What do you find of interest in this key concept?
Which of the three arguments for god's existence do you find most convincing? Do you believe...
Which of the three arguments for god's existence do you find most convincing? Do you believe it is able to overcome the objection to it that you mentioned in (2) above? Why or why not?
this issue is valuation for a startup company. What do you find to be the most...
this issue is valuation for a startup company. What do you find to be the most challenging when working with valuation? Why do you think that is? Also, consider what you think to be the most appropriate valuation method. Explain.   
Which Value Theory do you find most convincing? Why?                                 &nbsp
Which Value Theory do you find most convincing? Why?                                                           three different theories of value: hedonism, desire satisfaction theory, the objective list theory. Please briefly explain and defend whichever theory of value you find most credible. You should approach this task by presenting arguments, evidence, and/or examples that support your chosen theory. You might also consider presenting arguments, evidence, and/or examples that, in your view, discredit alternative theories.
how do you find lattice structures
how do you find lattice structures
Find a job description for a job you would like to do, list the key section...
Find a job description for a job you would like to do, list the key section criteria for the job. How would you keep up to date with industry trends? What training would you like to attend to increase your skills?
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT