Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

how do I do this in python? Given a dictionary as follows: courses = { 'bash': {'classes': 20, 'hours': 2, 'fee': 50}, PHP': {'classes': 10,

how do I do this in python?

image text in transcribed

Given a dictionary as follows: courses = { 'bash': {'classes': 20, 'hours': 2, 'fee': 50}, PHP': {'classes': 10, 'hours': 2, 'fee': 150}, 'Angular': {'classes': 25, 'hours': 2, 'fee': 100}, Python': {'classes': 15, 'hours': 2, 'fee': 100} } Write a function called calculate_fees (courses) that takes in courses as an input parameter which is a dictionary of dictionaries. The dictionary of dictionaries is of the above given format (course name as key followed by an inner dictionary of classes, hours and fee). The function returns the total fees for each of the courses separately as elements of a list. The total fee is calculated as: Total Fee = No. of classes * No. of hours * fee For example, for the given courses above, the function should return: [2000, 3000, 5000, 3000] Sample Input: {'Java': {'classes': 20, 'hours': 2, 'fee': 50}, "Python': {'classes': 14, 'hours': 2, 'fee': 150}} Sample Output: [2000, 4200]

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

Advances In Databases And Information Systems Uropean Conference Adbis 2020 Lyon France August 25 27 2020 Proceedings Lncs 12245

Authors: Jerome Darmont ,Boris Novikov ,Robert Wrembel

1st Edition

3030548317, 978-3030548315

More Books

Students also viewed these Databases questions