Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Python 3 # Starter Code def print_disk_quota(): Displays (to console) the amount of space in GB and percentage of space that major file types

Python 3

image text in transcribed

# 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 = 1024.0 # capacity of hard drive in GB media_percent = 365.0/1024.0 * 100.0 # percentage of hard drive occupied by multimedia files documents_percent = 10.0/1024.0 * 100.0 # percentage of hard drive occupied by document files applications_percent = 425.00/1024.0 * 100.0 # percentage of hard drive occupied by applications free_percent = 224.0/1024.0 * 100.0 # percentage of hard drive available

# 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.")

# testing function print_disk_quota()

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 occupy on the hard drive as well as the amount of space available for free calculate percentage of space occupied by certain file types capacity 1024.0 capacity of hard drive in GB media-percent 365.0 /1024.0 100.0 Percentage of hard drive occupied a by multimedia files documents-percent 10.0/1024 .0 100.0 Percentage of hard drive occupied by document files applications-percent 425.00/1024-0 100.0 a percentage of hard drive occupied by applications free-percent 224.0/ 1024.0 100.0 Percentage of hard drive availabl print disk quota to console print ("You have str (free-percent) "1 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) "2 of hard drive space (10.0 GB) is occupied by document files print (str Capplications-percent) "2 of hard drive space C425.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 itcan 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 a2q1-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

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_2

Step: 3

blur-text-image_step3

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

More Books

Students also viewed these Databases questions

Question

6. Explain how to train managers to coach employees.

Answered: 1 week ago