Python 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.
Python 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.
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 1 images