Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Question 1 (10 points): Purpose: To distinguish between the different parts of functions and function calls. Degree of Difficulty: Easy Below is a program that

image text in transcribed

Question 1 (10 points): Purpose: To distinguish between the different parts of functions and function calls. Degree of Difficulty: Easy Below is a program that uses a function to compute the cost of leaving toddlers at Angel's Day Care. There is cost of daycare per toddler (aged 1.5 to 3) that is charged daily. def day-care_cost (number_of_toddlers, number_of_days, cost-per_toddler): Computes the total cost of a stay at Angel's Day Care number_of_toddlers: the number of toddlers number_of_days: duration of stay in days cost-per_toddler: cost of daycare for a single toddler in dollars BRO VOLAWN Returns: total cost of the stay daily_toddler_cost = number_of_toddlers * cost_per_toddler total cost = daily_toddler_cost * number_of_days return total_cost 15 # compute the cost of a stay for 2 toddlers 16 # staying 5 days at a rate of $40.50 per toddler first stay = day care_cost (2, 5, 40.50) NO # compute the cost of a stay for 3 toddlers # staying 7 days at a rate of $29.75 per toddler second stay = day care_cost (3, 7, 29.75) Answer the following questions. Refer to line numbers if you find it helpful in your answers. (a) List all of the function arguments in this program. (b) List all of the function parameters in this program. (c) List all of the variables that are neither arguments or parameters. (d) What is the scope of: i. daily_toddler_cost ii. number_of_days iii. second_stay (e) How many function definitions are in this program? (f) How many function calls are in this program? (g) What are the values referred to by first_stay and second_stay when the program ends

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: 3

blur-text-image

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

Big Data Fundamentals Concepts, Drivers & Techniques

Authors: Thomas Erl, Wajid Khattak, Paul Buhler

1st Edition

0134291204, 9780134291208

More Books

Students also viewed these Databases questions