Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

( e ) 'Imagine a dictionary with the structure student _ id: [ student _ major, student _ cgpa ] . Assume majors are represented

(e) 'Imagine a dictionary with the structure student_id:[student_major, student_cgpa]. Assume majors are represented by strings like 'CoE', 'EEE', etc. Now define a function avg_cgpa_by_major that takes such a dictionary and a string for major as inputs and returns the average cgpa for all students with that major.
Sample input/Output:
In_1={41251:['CoE',2.5],42509:['EEE',3.1],41713:['CoE',1.9],41101:['CoE',2.7]}
print(avg_cgpa_by_major(In_1,"CoE"))
2.36
(f) Define a function called search_dict which will take a dictionary and a number as arguments. It will search through dictionary's values, and return True if that number appears in the dictionary as an integer or as a string
Sample input/Output:
d1 'Ahmet': 10, 'Zeynep': '5', Mehmet: '2'
image text in transcribed

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

Professional Android 4 Application Development

Authors: Reto Meier

3rd Edition

1118223853, 9781118223857

More Books

Students also viewed these Programming questions

Question

What is the critical value of F on your Excel printout?

Answered: 1 week ago

Question

A 30 year old person should know better.

Answered: 1 week ago

Question

Our service is (good) than theirs.

Answered: 1 week ago