Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Function print_disk_quota displays the amount of space in gigabytes (GB) and percentage of space that specific file types occupy on a hard drive: def print

image text in transcribed
image text in transcribed
Function print_disk_quota displays the amount of space in gigabytes (GB) and percentage of space that specific file types occupy on a hard drive: def print disk.quota (): Displays (to console) the amount of space in GB and percentage of space that major file types occupPy on the hard drive as vell as the amount of space free/available for use. * calculate percentage of space occupied by certain file types * capacity of hard drive in GB * percentage of hard drive occupied * by multimedia files * percentage of hard drive occupied E by document files * percentage of hard drive occupied I by applications # percentage of hard drive available capacity- 1024.0 media percent - 365.0/1024.0 . 100.0 documents -percent- 10.0/1024.0 100.0 applications-percent - 425.00/1024.0 100.0 free-percent- 224.0/1024.0 100.0 * print disk quota to console print ("You have "+str (free-percent)+"% of "+str(capacity)+" GB free. ") print (str (media percent) +"% of hard drive space (365.0 GB) "+ " is occupied by multimedia files.") print (str (documents percent) +"% of hard drive space (10.0 GB) "+ " is occupied by document files. ") print (str (applications percent)+"% of hard drive space (425.0 GB) "+ is occupied by applications. ") Recall that the generalization of a function is the process of revising a function to solve a wider range of problems. Generalize this function by converting appropriate literal values in the function into parameters so that it can print the disk quota usage for different hard drive capacities and different amounts of space used by each file type. You may have to modify multiple lines of the function body to accommodate for a new parameter value. Also modify the docstring to describe the new parameters. The above function is already provided for you in a2q3-starter.py. so you don't have to re-write it. You should test that the function produces the same output for every parameter introduced. That is, if you give the function the same specific inputs used in the starter code as arguments for your new parameters, you should wind up with the same output in both scenarios. def print_disk_quota(): Displays (to console) the amount of space in GB and percentage of space that major file types occupy on the hard drive as well as the amount of space free/available for use. # calculate percentage of space occupied by certain file types capacity = 4096.0 # capacity of hard drive in GB = 586.0 / 4096.0 * 100.0 applications_percent documents percent = 125.0 / 4096.0 * 100.0 media_percent free_percent = 2370 / 4096.0 * 100.0 %3D 1015.0 / 4096.0 * 100.0 # print disk quota to console print("You have "+str(free_percent) +"% of "+str(capacity)+" GB free.") print (str(applications_ percent)+"% of hard drive space (586.0 GB) is occupied by applications.") print(str(documents_percent)+"% of hard drive space (125.0 GB) is occupied by document files.") print (str(media_percent)+"% of hard drive space (1015.0 GB) is occupied by multimedia files.") # testing function print_disk_quota() # after you make your changes, the following function call should work instead: # print_disk_quota(4096.0,586.0,125.0,1015.0)

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

Database Concepts

Authors: David Kroenke

4th Edition

0136086535, 9780136086536

More Books

Students also viewed these Databases questions

Question

8. Do the organizations fringe benefits reflect diversity?

Answered: 1 week ago