Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Problem 3.) You are writing a function for a truck rental company. The company c

ID: 3743881 • Letter: P

Question

Problem 3.) You are writing a function for a truck rental company. The company charges $20.99 per dayand$D2 per mile driven. The user needs to input the number of days of rental and the the total miles driven. The function should return two variables: total cost and daily averaqe. The total cost is the total the truck renter will pay. The daily average is the cost averaged across the number of days of rental. Complete the function so that these two variables are computed NOTE: The return statement here does two things. First, it rounds total_cost and daily_average to two decimal places... the nearest penny. Also, it returns two values, separated by a comma. This return type is a tuple. With two elements being returned, the output is what we think of as ordered pairs in mathematics. 57]: def truck_cost (days, miles): #TYPE YOUR CODE HERE x- miles y= days return round = 0.29x + 20 . 99y return round(total_cost, 2), round(daily_average, 2) File "", line 6 return round-.29x 20.99y SyntaxError: invalid syntax

Explanation / Answer

def truck_cost(days, miles): total_cost = days*20.99 + miles*0.29 return total_cost, total_cost/days days = int(input('Enter number of days: ')) miles = float(input('Enter number of miles: ')) total, average = truck_cost(days, miles) print('Total cost is $%.2f' % total) print('Average cost per day is $%.2f' % average)

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote