
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
expand_more
expand_more
format_list_bulleted
Concept explainers
Question
- Write a 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:
- 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.
- 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.
- 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.
- 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.
- Call the storage_info function with the user-provided data_size, backup_frequency, cost_per_gb, and weeks and print the returned string.
- Provide comments in your code to explain the logic used.
- Test your program with different inputs and ensure that it performs the calculations correctly.
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution
Trending nowThis is a popular solution!
Step by stepSolved in 4 steps with 3 images

Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- How can I Write a Python program that can convert a Fahrenheit temperature to Celsius, or vice versa. The program should use two custom functions, f_to_c and c_to_f, to perform the conversions. Both of these functions should be defined in a custom module named temps. Custom function c_to_f should be a void function defined to take a Celsius temperature as a parameter. It should calculate and print the equivalent Fahrenheit temperature accurate to three decimal places. Custom function f_to_c should be a value-returning function defined to take a Fahrenheit temperature as a parameter. This function should calculate the equivalent Celsius temperature and return it. In the main function, your program should: prompt the user to enter a temperature (as a float type). indicate the temperature scale of the temperature just entered. call the appropriate function from the temps module. if the Celsius temperature is being determined, it should be displayed accurate to three decimal places.arrow_forward2. Create a module named grading that contains the following two functions: • calc_average() – this function should accept five (integer) test Scores as arguments and return the average of the scores. • determine_grade() – this function should accept a test score as an argument and return a letter grade (string) for the score, based on the following: A 90-100 80-89 C 70-79 60-69 F Below 60 Write a program that imports your grading module. Your program should include a main() function that asks the user to enter five test scores. The program should display a letter grade for each score and the average test score rounded to 1 decimal place.arrow_forwardWhich of the following is true about designing and writing a function in Python? OThe name of a function should be a single word loosely associated with what the function does. OParameter variable names must be the same name as the arguement variable that will be passed to them. OWhen writing a function, the more arguments the better. OFunctions that are defined by the user and used in the source code file in which they are defined must be defined at the top of the source code file, before the first use of the function. OWhen writing a function, try to do as much as possible in a single function.arrow_forward
- Develop a Python function named "display_bookstore_info" to convey details about "Bookworm Haven." The function should include the following information: 1. A warm welcome message and the precise location of the bookstore. 2. An overview of the book categories available, highlighting bestsellers, fiction, non- fiction, science fiction, and children's books. 3. Any ongoing promotions or loyalty programs, such as "Buy 3 books, get a 10% discount with our Bookworm Rewards Card!" 4. Operational hours specified for each day of the week. 5. Contact details, including a customer support email (support@bookwormhaven.com) and a customer service hotline (1-800-READNOW). Ensure to call the function to present the provided information.arrow_forwardQuestion 1 Write a function to print “hello_USERNAME!” USERNAME is the input of the function. The first line of the code has been defined as below. def hello_name(user_name): ..... Question 2 Write a python function, first_odds that prints the odd numbers from 1-100 and returns nothing def first_odds(): ..... Question 3 Please write a Python function, max_num_in_list to return the max number of a given list. The first line of the code has been defined as below. def max_num_in_list(a_list): ..... Question 4 Write a function to return if the given year is a leap year. A leap year is divisible by 4, but not divisible by 100, unless it is also divisible by 400. The return should be boolean Type (true/false). def is_leap_year(a_year): ..... Question 5 Write a function to check to see if all numbers in list are consecutive numbers. For example, [2,3,4,5,6,7] are consecutive numbers, but [1,2,4,5] are not consecutive numbers. The return should be boolean Type.arrow_forward
arrow_back_ios
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education

Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON

C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON

Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning

Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education