Question: 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?

how do I do this in python? Given a dictionary as follows:

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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!