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
# https://fivethirtyeight.com/features/work-a-shift-in-the-riddler-gift-shop/ | |
# riddler express | |
# https://docs.google.com/spreadsheets/d/1n2WNPOeR2iOeWf5pUpHU6P92MDH7sk3rsUtvdFUsmHM/edit#gid=0 | |
import random | |
random.seed(0) | |
# what if the half pills fall out of your hands back into the bottle? | |
# let p stand for probablity between 0 and 1. | |
def sample_pills_extra_credit(i, p): |
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
from datetime import datetime as dt | |
# timestamp microseconds | |
timestamp = '1490871689000' | |
# String to remove miliseconds or it'll break | |
converted_timestamp = int(timestamp[:-3]) | |
# I want a timestamp that's human readable! | |
converted_timestamp = dt.fromtimestamp(converted_timestamp) |
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
# https://fivethirtyeight.com/features/what-are-the-chances-well-meet-for-lunch/ | |
# On a lovely spring day, you and I agree to meet for a lunch picnic at the fountain in the center of our favorite park. | |
# We agree that we’ll each arrive sometime from noon and 1 p.m., | |
# and that whoever arrives first will wait up to 15 minutes for the other. | |
# If the other person doesn’t show by then, the first person will abandon the plans and spend the day with a more punctual friend. | |
# If we both arrive at the fountain at an independently random time between noon and 1, what are the chances our picnic actually happens? | |
import random | |
# Seed makes the result identical for every run |
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
# results https://docs.google.com/spreadsheets/d/1q3YD0AlzynouZmyBJqCWTnxAClhHoagoEGcHH3OncAc/edit?usp=sharing | |
# This video would have been super helpful to watch BEFORE trying this problem | |
# https://www.youtube.com/watch?v=stgYW6M5o4k | |
# SOLUTION! | |
# https://fivethirtyeight.com/features/what-are-the-chances-well-meet-for-lunch/ | |
# [This program is wrong.] | |
import random | |
max_time = 10000 |
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
# What's the best guess? | |
tm = float(input("Most probable Time (Tm) = ")) | |
# If everything goes well, how long would it take? | |
to = float(input("Optimistic Time (To) = ")) | |
# If everything bad happens, how long would it take? | |
# Probable time | |
tp = float(input("Pessimistic Time (Tp) = ")) |
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
print 'test' | |
import random | |
def chromosome(): | |
gene = "" | |
for i in xrange(8): | |
gene += str(random.randint(0,1)) | |
return gene |
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
Show hidden characters
{ | |
"always_show_minimap_viewport": true, | |
"auto_complete_triggers": | |
[ | |
{ | |
"characters": "<", | |
"selector": "text.html" | |
}, | |
{ | |
"characters": ".", |
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 numpy as np | |
from matplotlib import pyplot as plt | |
from numpy import zeros, ones, reshape, array, linspace, logspace, add, dot, transpose, shape, negative | |
# import matplotlib.pyplot as plt | |
from pylab import scatter, show, title, xlabel, ylabel, plot, contour | |
a = np.identity(5) | |
# print(a) |
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 csv | |
csvfile_A = 'example.csv' | |
csvfile_B = 'anotherexample.csv' | |
delimiter = '\n' | |
data_alpha = [] | |
data_beta = [] | |
data_matched = list() | |
data_no_matched = list() |
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
egrep -o '\w+(.\w)*@\w+\.\w.\S' * |