Last active
March 9, 2017 10:19
-
-
Save anddam/1da4db4ae5aec7d881d9f6044ea97170 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# All comprehension approach | |
data = {percentage: [multiple_toss(times=times, | |
steps=step, | |
percentage=percentage, | |
factor=factor, | |
balance=balance | |
) | |
for step in range(step_limit) | |
] | |
for percentage in percentages | |
} | |
# All explicit loops approach | |
data = {} | |
for percentage in percentages: | |
column = [] | |
for step in range(step_limit): | |
column.append(multiple_toss(times=times, | |
steps=step, | |
percentage=percentage, | |
factor=factor, | |
balance=balance | |
)) | |
data[percentage] = column | |
# Hybrid approach | |
data = {} | |
for percentage in percentages: | |
data[percentage] = [multiple_toss(times=simulations_number, | |
steps=step, | |
percentage=percentage, | |
) | |
for step in range(step_limit) | |
] | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment