Skip to content

Instantly share code, notes, and snippets.

View ndunn219's full-sized avatar

Nat Dunn ndunn219

View GitHub Profile
@ndunn219
ndunn219 / monty_hall.py
Last active October 23, 2015 17:05
This is a Python model for the Monty Hall problem. See comment below for credit.
import random
class MontyHall:
def __init__(self):
self._prize_door = random.randint(1,3)
self._selected_door = random.randint(1,3)
self._removed_door = self.remove_door()
def remove_door(self):
doors = [1,2,3]
# import modules
import re
def sort_streets(street_list):
"""
Sort streets alphabetically, ignoring cardinal direction prefixes such as North, South, East and West
:param street_list: list of street names
"""
prefix = re.compile('^North|South|East|West|N\.?|S\.?|E\.?|W\.$', re.IGNORECASE)