Skip to content

Commit 98f4892

Browse files
authored
Merge pull request rhettinger#2 from alexlab2017/patch-1
Generator expression instead of list comprehension
2 parents 07c7109 + 8c63f2b commit 98f4892

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

resampling.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def trial():
3434

3535
# Probability of the median of 5 samples being in the
3636
# middle two quartiles of the population
37-
trial = lambda : 2500 <= sorted([randrange(10000) for i in range(5)])[2] < 7500
37+
trial = lambda : 2500 <= sorted(randrange(10000) for i in range(5))[2] < 7500
3838
print(sum(trial() for i in range(10000)) / 10000.0) # compare with the beta distribution
3939

4040
# An exact permutation text

0 commit comments

Comments
 (0)