Question: Create a python program for the given problem. Problem D: Buffet Admission, Revisited LIST COMPREHENSION A buffet restaurant determines the price of admission based on
Create a python program for the given problem.
Problem D: Buffet Admission, Revisited
LIST COMPREHENSION
A buffet restaurant determines the price of admission based on the height of the guest in
centimeters. Guests that are below centimeters tall are admitted without charge. Guests
who are centimeters to centimeters tall are charged pesos. Guests who are taller
than centimeters up to centimeters are charged pesos. Admission for all other
guests are pesos.
Create a function named calculateCost that accepts a list of heights from the user. Your
function should print the total admission cost for the group with an appropriate message. The
total cost should be displayed using two decimal places. It is expected that the user will input
positive numbers.
Your function must only use list comprehensions to calculate the total admission cost; no
loops and no ifelifelse chains are allowed.
End your code with a call to the print function containing two parameters. The first one
should be PHP The second one is calculateCost. For its own parameter, calculateCost should
have the input function wrapped inside the eval function.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
