On Tue, 24 Nov 2015 10:04 pm, Cai Gengyang wrote:

> results = {
>   "gengyang": { "maths": 10, "english": 15},
>   "ensheng": {"maths": 12, "english": 10},
>   "jordan": {"maths": 9, "english": 13}
>   }
> 
> How do you get gengyang's maths scores ?

Break the problem into two steps:

- get Gengyang's scores;

- then get the maths score:

scores = results['gengyang']
maths_score = scores['maths']


Now you can simplify the process:

maths_score = results['gengyang']['maths']



-- 
Steven

-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to