I hereby claim:
- I am paradoor on github.
- I am fopdudel (https://keybase.io/fopdudel) on keybase.
- I have a public key ASDlYjqPzMc98cfhaVwks5IUU7YAyVY_krCChcuo4xCGBgo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
| #!/usr/bin/python3 | |
| """A demonstration of the Monty Hall problem.""" | |
| import argparse | |
| import random | |
| import json | |
| # n is the number of times you switch, and also the number of times you don't switch | |
| # accuracy increases as n increases |
| def get_startswith_substring(string: str, substrings): | |
| """ | |
| Gets the substring that another string starts with. | |
| :param string: The larger string, eg "The quick brown fox jumps over the lazy dog." | |
| :param substrings: The list or tuple of substrings you want to check against, e.g. ["foo", "bar", "Th"] | |
| :return: If found, a string (that comes from substrings). If not found, None. e.g. "Th" | |
| :raises: TypeError if substrings is not a list or tuple. | |
| """ | |
| if not (isinstance(substrings, list) or isinstance(substrings, tuple)): | |
| raise TypeError |
| # make `echo "$calculation" | bc` much easier to type. | |
| # if `calc` is already in use, feel free to change it to something else. | |
| calc () { echo "$@" | bc; } |