Question
Write a Python script program that contains multiple user-defined functions which calculate storage requirements and costs. These functions will provide useful metrics in the context
Write a Python script program that contains multiple user-defined functions which calculate storage requirements and costs. These functions will provide useful metrics in the context of data storage and backup solutions. Perform the following steps:
1. Create a function named calculate_backup_size that takes two arguments: data_size (in gigabytes) and backup_frequency. This function should return the data_size multiplied by backup_frequency, representing the total storage needed for backups in a week.
2. Create another function named calculate_storage_cost that takes two arguments: backup_size and cost_per_gb. This function should return the value of backup_size multiplied by cost_per_gb, representing the total cost for the backup storage.
3. Create a third function named storage_info that takes four arguments: data_size, backup_frequency, cost_per_gb, and weeks. This function should call calculate_backup_size and calculate_storage_cost functions, taking the appropriate arguments. Then it should multiply the cost by the number of weeks. It should return a string that says "The total storage needed for backup is X GB and the total cost for Y weeks is Z dollars", replacing X, Y, and Z with the calculated values.
4. Prompt the user to enter values for data_size, backup_frequency, cost_per_gb, and weeks. If the user does not enter a positive number, your program should catch this error and ask for the input again.
5. Call the storage_info function with the user-provided data_size, backup_frequency, cost_per_gb, and weeks and print the returned string.
6. Provide comments in your code to explain the logic used.
7. Test your program with different inputs and ensure that it performs the calculations correctly. When your program runs, it should match the expected output. The program should work for any valid inputs that the user provides.
r $ .flab_g_task_85_sdevilrpy Enter the size of the data in GB: 833 Enter the backup frequency per week:? Enter the cost per GB ($3: 0461979 Enter the number of weeks: 8 The total storage needed for backup is 5606.6 GB and the total cost for 8 weeks is $886.59 dollars $Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started