In: Computer Science
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.
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()