Finding the average
Your next task is to check delivery times during peak dinner hours (6-9 PM) for a restaurant to optimize platform performance. You have a delivery_times list containing delivery times in minutes.
Let's use the built-in functions to calculate the average delivery time.
This exercise is part of the course
Intermediate Python for Developers
Exercise instructions
- Find the average delivery time, saving as
average_time. - Round the
average_timeto two decimal places, saving asaverage_rounded.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
delivery_times = [19, 25, 35, 40, 28, 32, 29, 31]
# Find the average delivery time
average_time = ____(delivery_times) / ____(delivery_times)
# Round the average delivery time to two decimal places
average_rounded = ____(____, ____)
print("Average delivery time:", average_rounded)