Created
May 28, 2023 09:40
-
-
Save Trafitto/b0c2dcafb612bad82ed74135e4379c81 to your computer and use it in GitHub Desktop.
Not the end tools
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
import random | |
def simulate(num_tokens_to_pick, black_tokens, white_tokens): | |
picked_tokens = [] | |
for _ in range(min(num_tokens_to_pick, black_tokens)): | |
picked_tokens.append("black") | |
black_tokens -= 1 | |
num_tokens_to_pick -= 1 | |
for _ in range(min(num_tokens_to_pick, white_tokens)): | |
picked_tokens.append("white") | |
white_tokens -= 1 | |
num_tokens_to_pick -= 1 | |
random.shuffle(picked_tokens) | |
return picked_tokens | |
black_tokens = int(input("How black token you put in that bag?")) | |
white_tokens = int(input("How white token you put in that bag?")) | |
num_tokens_to_pick = int(input("How many time you want to pick? ")) | |
print(simulate(num_tokens_to_pick, black_tokens, white_tokens)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment