Python: Find the name of the oldest student from a given dictionary
Python Basic - 1: Exercise-101 with Solution
Write a Python program to find the name of the oldest student in a given dictionary containing the names and ages of a group of students.
Sample Solution:
Python Code:
def oldest_student(students):
return max(students, key=students.get)
print(oldest_student({"Bernita Ahner": 12, "Kristie Marsico": 11,
"Sara Pardee": 14, "Fallon Fabiano": 11,
"Nidia Dominique": 15}))
print(oldest_student({"Nilda Woodside": 12, "Jackelyn Pineda": 12.2,
"Sofia Park": 12.4, "Joannie Archibald": 12.6,
"Becki Saunder": 12.7}))
Sample Output:
Nidia Dominique Becki Saunder
Flowchart:

Python Code Editor:
Have another way to solve this solution? Contribute your code (and comments) through Disqus.
Previous: Write a Python program to compute the sum of all items of a given array of integers where each integer is multiplied by its index.
Next: Write a Python program to create a new string with no duplicate consecutive letters from a given string.
What is the difficulty level of this exercise?
Test your Programming skills with w3resource's quiz.
- Weekly Trends
- Python Interview Questions and Answers: Comprehensive Guide
- Scala Exercises, Practice, Solution
- Kotlin Exercises practice with solution
- MongoDB Exercises, Practice, Solution
- SQL Exercises, Practice, Solution - JOINS
- Java Basic Programming Exercises
- SQL Subqueries
- Adventureworks Database Exercises
- C# Sharp Basic Exercises
- SQL COUNT() with distinct
- JavaScript String Exercises
- JavaScript HTML Form Validation
- Java Collection Exercises
- SQL COUNT() function
- SQL Inner Join