Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Introduction To Constraint Databases

Authors: Peter Revesz

1st Edition

1441931554, 978-1441931559

More Books

Students also viewed these Databases questions

Question

3-2 What is the impact of information systems on organizations?

Answered: 1 week ago