Question
PYTHON Write a function that accepts a dictionary and a string as parameters; the dictionarys keys are students names, and the values are students ages;
PYTHON Write a function that accepts a dictionary and a string as parameters; the dictionarys keys are students names, and the values are students ages; the second parameter is a student name. The function should use the second parameter to search for students age in the dictionary; if the student exist in the dictionary, the function returns its age, otherwise, returns -1.Create a dictionary in your program and use it to test the function.You may use the below dictionary:{42: 'Marty', 81: 'Sue', 17: 'Ed', 31: 'Dave',56: 'Ed', 3: 'Marty', 29: 'Ed'}
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started