diff options
author | Raymond Hettinger <rhettinger@users.noreply.github.com> | 2020-05-21 08:37:38 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-21 08:37:38 (GMT) |
commit | e16d2f7c37b2689dd3cb1ac36bcf875926b5f1f6 (patch) | |
tree | 8e472f4d143e95cf1977856ad271ea1f312665a2 /Doc | |
parent | 0f56263e62ba91d0baae40fb98947a3a98034a73 (diff) | |
download | cpython-e16d2f7c37b2689dd3cb1ac36bcf875926b5f1f6.zip cpython-e16d2f7c37b2689dd3cb1ac36bcf875926b5f1f6.tar.gz cpython-e16d2f7c37b2689dd3cb1ac36bcf875926b5f1f6.tar.bz2 |
Improve output summary in the examples and recipes section (GH-20285)
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/library/random.rst | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Doc/library/random.rst b/Doc/library/random.rst index 90366f4..0cdf0a6 100644 --- a/Doc/library/random.rst +++ b/Doc/library/random.rst @@ -494,7 +494,7 @@ Simulation of arrival times and service deliveries for a multiserver queue:: from heapq import heappush, heappop from random import expovariate, gauss - from statistics import mean, median, stdev + from statistics import mean, quantiles average_arrival_interval = 5.6 average_service_time = 15.0 @@ -513,8 +513,8 @@ Simulation of arrival times and service deliveries for a multiserver queue:: service_completed = arrival_time + wait + service_duration heappush(servers, service_completed) - print(f'Mean wait: {mean(waits):.1f}. Stdev wait: {stdev(waits):.1f}.') - print(f'Median wait: {median(waits):.1f}. Max wait: {max(waits):.1f}.') + print(f'Mean wait: {mean(waits):.1f} Max wait: {max(waits):.1f}') + print('Quartiles:', [round(q, 1) for q in quantiles(waits)]) .. seealso:: |