Returning a result from 3 items in a list

Mark Lawrence breamoreboy at yahoo.co.uk
Tue Nov 24 09:28:57 EST 2015


On 24/11/2015 14:07, Denis McMahon wrote:
> On Tue, 24 Nov 2015 02:04:56 -0800, Cai Gengyang wrote:
>
>> Here's a dictionary with 3 values :
>>
>> results = {
>>    "gengyang": 14,
>>    "ensheng": 13, "jordan": 12
>> }
>>
>> How do I define a function that takes the last of the 3 items in that
>> list and returns Jordan's results i.e. (12) ?
>
> You open a web browser and google for "python dictionary"
>

Ooh steady on old chap, surely you should have fitted the bib, done the 
spoon feeding and then changed the nappy?  That appears to me the 
preferred way of doing things nowadays on c.l.py, rather than bluntly 
telling people not to be so bloody lazy.

-- 
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.

Mark Lawrence




More information about the Python-list mailing list