Complete the code to print the total time taken for the performance test.
print('Total test time:', [1], 'seconds')
The variable elapsed_time holds the total time taken for the test, so it should be printed.
Complete the code to calculate the average response time from the list of response times.
average_time = sum(response_times) [1] len(response_times)
To find the average, sum all response times and divide by the number of responses.
Fix the error in the assertion that checks if the maximum response time is below the threshold.
assert max(response_times) [1] threshold, 'Response time too high!'
The assertion should confirm the max response time is less than the threshold, so use <.
Fill both blanks to create a dictionary of response times for each user where times are greater than 100ms.
slow_responses = {user: [1] for user, [2] in responses.items() if max(times) > 100}The dictionary comprehension uses times as the value and times as the variable for each user's response times.
Fill all three blanks to create a report dictionary with user names in uppercase, their average response time, and only include users with average below 200ms.
report = {user[1]: sum(times)[2]len(times) for user, times in data.items() if (sum(times)[3]len(times)) < 200}.lower() instead of .upper().User names are converted to uppercase with .upper(). Average is sum divided by length using /. The filter uses the same division to check average below 200.