function name: cap_at_100 o parameters: a number grade • returns: the grade with a maximum of 100 o behavior: This function normalizes grades. If a student does a lot of extra credit they may have a final grade that is greater than 100, but we need to bring that down to 100 for the final grade. If the grade is <= 100 we don't need to change anything. ex: cap_at_100(75) returns 75, and cap_at_100(103) returns 100 function name: bound_0_to_100 o parameters:a number grade o returns: the grade with a minimum of 0 and a maximum of 100 o behavior: In addition to exceeding 100, sometimes a grade will be so spectacularly bad that it falls below 0. In that case we want to normalize it to 0 so all grades fall into the range [0, 100]. ex: bound_0_to_100(75) returns 75, bound_0_to_100(103) returns 100, and bound_0_to_100(-5) returns 0 function name: sum_range • parameters: two numbers, a start and a stop o returns: the sum of numbers in the range [start, stop) o behavior: sums the values in the range excluding the stop but including the start. ex: sum_range (3, 7) returns 3+4+5+6, which is 18 function name: pizza_total o parameters: a number num_pizzas and a bool is_delivery • returns: The total for a pizza order o behavior: Each pizza costs $12 and delivery costs $4. If is_delivery is True, you should add a delivery charge to the total. ex: pizza_total(2, True) returns 28 (12*2 +4), and pizza_total(3, False) returns 36 (12 3) function name: is_even o parameters: a number n o returns: True if n is even (n is a multiple of 2), False otherwise o behavior: ex: is_even(4) is True, and is_even(7) is False function name: is_divisble_by o parameters: two numbers, num and a divisor o returns: True if num is divisible by divisor, False otherwise o behavior: Much like is_even, but rather than checking if it is divisible by 2, check if the number is divisible by divisor. ex: is_divisible_by (9,4) is False, and is_divisible_by (9, 3) is True

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

python

function name: cap_at_100
o parameters: a number grade
o returns: the grade with a maximum of 100
o behavior: This function normalizes grades. If a student does a lot of extra credit they may have a
final grade that is greater than 100, but we need to bring that down to 100 for the final grade. If the
grade is <= 100 we don't need to change anything. ex: cap_at_100(75) returns 75, and
cap_at_100(103) returns 100
function name: bound_0_to_100
o parameters.a number grade
o returns: the grade with a minimum of 0 and a maximum of 100
o behavior: In addition to exceeding 100, sometimes a grade will be so spectacularly bad that it falls
below 0. In that case we want to normalize it to 0 so all grades fall into the range [0, 100]. ex:
bound_0_to_100(75) returns 75, bound_0_to_100(103) returns 100, and bound_0_to_100(-5)
returns 0
function name: sum_range
o parameters: two numbers, a start and a stop
o returns: the sum of numbers in the range [start, stop)
o behavior: sums the values in the range excluding the stop but including the start. ex:
sum_range (3, 7) returns 3+4+5+6, which is 18
function name: pizza_total
o parameters: a number num_pizzas and a bool is_delivery
o returns: The total for a pizza order
o behavior: Each pizza costs $12 and delivery costs $4. If is_delivery is True, you should add a
delivery charge to the total. ex: pizza_total(2, True) returns 28 (12*2 +4), and
pizza_total(3, False) returns 36 (12 3)
function name: is_even
o parameters: a number n
o returns: True if n is even (n is a multiple of 2), False otherwise
o behavior: ex: is_even(4) is True, and is_even(7) is False
function name: is_divisble_by
o parameters: two numbers, num and a divisor
o returns: True if num is divisible by divisor, False otherwise
o behavior: Much like is_even, but rather than checking if it is divisible by 2, check if the number is
divisible by divisor. ex: is_divisible_by(9,4) is False, and is_divisible_by(9, 3) is True
Transcribed Image Text:function name: cap_at_100 o parameters: a number grade o returns: the grade with a maximum of 100 o behavior: This function normalizes grades. If a student does a lot of extra credit they may have a final grade that is greater than 100, but we need to bring that down to 100 for the final grade. If the grade is <= 100 we don't need to change anything. ex: cap_at_100(75) returns 75, and cap_at_100(103) returns 100 function name: bound_0_to_100 o parameters.a number grade o returns: the grade with a minimum of 0 and a maximum of 100 o behavior: In addition to exceeding 100, sometimes a grade will be so spectacularly bad that it falls below 0. In that case we want to normalize it to 0 so all grades fall into the range [0, 100]. ex: bound_0_to_100(75) returns 75, bound_0_to_100(103) returns 100, and bound_0_to_100(-5) returns 0 function name: sum_range o parameters: two numbers, a start and a stop o returns: the sum of numbers in the range [start, stop) o behavior: sums the values in the range excluding the stop but including the start. ex: sum_range (3, 7) returns 3+4+5+6, which is 18 function name: pizza_total o parameters: a number num_pizzas and a bool is_delivery o returns: The total for a pizza order o behavior: Each pizza costs $12 and delivery costs $4. If is_delivery is True, you should add a delivery charge to the total. ex: pizza_total(2, True) returns 28 (12*2 +4), and pizza_total(3, False) returns 36 (12 3) function name: is_even o parameters: a number n o returns: True if n is even (n is a multiple of 2), False otherwise o behavior: ex: is_even(4) is True, and is_even(7) is False function name: is_divisble_by o parameters: two numbers, num and a divisor o returns: True if num is divisible by divisor, False otherwise o behavior: Much like is_even, but rather than checking if it is divisible by 2, check if the number is divisible by divisor. ex: is_divisible_by(9,4) is False, and is_divisible_by(9, 3) is True
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 6 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY