The function could be written as:
def total_cost(hours):
initial_fee = 65
hourly_rate = 2.50
cost = initial_fee + (hours * hourly_rate)
return cost
In this function, the parameter "hours" represents the number of hours Mrs. Beckner plans to use the surfboard. The function calculates the total cost by adding the initial fee of $65 to the product of the number of hours and the hourly rate of $2.50. The result is then returned as the final cost.
Mrs. Beckner is going to Hawaii. She plans to learn to surf. The Surf Hut company charges an initial fee of $65 for the lesson plus $2.50 for each hour she uses the surfboard.
Write a function for the total cost of the surf lesson and surfboard rental.
1 answer