Latest web development tutorials

Python includes exercises 78

Python 100 Li Python 100 Li

Title: Find the oldest person, and output. Please find the program you have any questions.

Program Analysis: None.

Source Code:

#!/usr/bin/python
# -*- coding: UTF-8 -*-

if __name__ == '__main__':
    person = {"li":18,"wang":50,"zhang":20,"sun":22}
    m = 'li'
    for key in person.keys():
        if person[m] < person[key]:
            m = key

    print '%s,%d' % (m,person[m])

The above example output is:

wang,50

Python 100 Li Python 100 Li