Question: # Starter Code def print_disk_quota(): Displays (to console) the amount of space in GB and percentage of space that major file types occupy on
# Starter Code
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 = 2048.0 # capacity of hard drive in GB applications_percent = 321.0 / 2048.0 * 100.0 documents_percent = 46.0 / 2048.0 * 100.0 media_percent = 899.0 /2048.0 * 100.0 free_percent = 782.0 /2048.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 (321.0 GB) is occupied by applications.") print(str(documents_percent)+"% of hard drive space (46.0 GB) is occupied by document files.") print(str(media_percent)+"% of hard drive space (899.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(2048.0,321.0,46.0,899.0)
PYTHON HOMEWORK HELP!!
data above pictures 
Purpose: To generalize an existing function so that it can perform a wider range of subtasks. Degree of Difficulty: Moderate 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 Tile types occupy on the hard drive as welI as the amount of space free/available for use # calculate percentage of space occupied by certain file types capacity 2048.0 # capacity of hard drive in GB applications-percent = 321.0/2048.0 * 100.0 documents-percent 46.0/2048.0 * 100.0 media-percent = 899.0/2048.0 * 100.0 free-percent 782.0/2048.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 (321.0 GB)"+ " is occupied by applications.") " is occupied by document files.") " is occupied by multimedia files.") print (str (documents-percent)+"% of hard drive space (46.0 GB) print (str(media-percent)+"% of hard drive space (899.0 GB)"+ 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 new parameter values. Also modify the docstring to describe the new parameters (currently none) The above function is already provided for you in a2q4-starter.py, so you don't have to re-write it. You should demonstrate that your new version of the function produces the same output for every parame- ter introduced. That is, if you were to call your new function using print_disk_quota(2048.0,321.0,46.0,899.0) you should wind up with the exact same output as the starter code
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
