Ask your own question, for FREE!
MIT 6.00 Intro Computer Science (OCW) 15 Online
OpenStudy (anonymous):

any one who knows a function that gets values for specific keys in dictionary

OpenStudy (vaboro):

a function? why? you get values from a dictionary by keys, for example, value = dict[key] would assign the value associated with 'key' to variable 'value'

OpenStudy (anonymous):

To loop through all keys in your dictionary: >>> dict = {'Name': 'My Name', 'Age': 'haha'} >>> for key in dict.keys(): >>> print "key: %s , value: %s" % (key, dict[key]) If you just want to get one value out of the dictionary based on it's key: >>>dict = {'Name': 'My Name', 'Age': 'haha'} >>> print "Value : %s" % dict.get('Age')

OpenStudy (anonymous):

http://dpaste.com/786438/

OpenStudy (anonymous):

keys with specific values? http://dpaste.com/786448/

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!