This file contains 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 create_boxes(): | |
""" Create a list of 100 boxes, each containing a unique number from 1 to 100. """ | |
numbers = list(range(1, 101)) | |
random.shuffle(numbers) | |
return numbers | |
def find_number(boxes, prisoner_number): | |
""" Simulate a prisoner trying to find their number using the loop strategy. """ |
This file contains 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
def load_words(): | |
with open('words.txt') as word_file: | |
valid_words = set(word_file.read().split()) | |
return valid_words | |
if __name__ == '__main__': | |
english_words = load_words() | |
for word in english_words: | |
word = word.replace('-', '') | |
if len(word) > 4: |
This file contains 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
### Keybase proof | |
I hereby claim: | |
* I am mettler on github. | |
* I am mettler (https://keybase.io/mettler) on keybase. | |
* I have a public key whose fingerprint is 1C14 1B35 92EC 68C6 807E 0B33 8305 3D75 0F12 BE68 | |
To claim this, I am signing this object: |