Skip to content

Instantly share code, notes, and snippets.

View leotrs's full-sized avatar

Leo Torres leotrs

View GitHub Profile
"""
schieber.py
-----------
Python implementation of the distance method in 'Quantification of network
structural dissimilarities', by Schieber et al.
"""
import numpy as np
"""
dfs.py
------
https://www.hackerrank.com/challenges/connected-cell-in-a-grid
09/22/16
"""
def get_neighbors(i, j):
"""
https://github.com/reeddunkle/Codjo/tree/master/Problem3_Rangoli
"""
from string import ascii_lowercase
from itertools import chain
def reflect(iterable):
return chain(reversed(iterable), iterable[1:])
# Merged your top-level comment into the docstring.
""" Exercise 8, Chapter 10
This exercise pertains to the so-called Birthday Paradox, which you can read
about at http://en.wikipedia.org/wiki/Birthday_paradox.
If there are 23 students in your class, what are the chances that two of you
have the same birthday? You can estimate this probability by generating random
samples of 23 birthdays and checking for matches. Hint: you can generate random
birthdays with the randint function in the random module.
"""
Earlier today, in the Recurse Center Slack Room, one of my mentors jokingly suggested
a project idea for a "cool metal band generator." I thought that was a fun idea,
so I made one. Whether the names generated are cool or not is up for debate.
Some examples:
* asses vile
* enfeeble revocation
* dominie dying fetus
* overexercise nile
@leotrs
leotrs / largestpalindrome.py
Last active July 19, 2016 22:32
dojo 19/7/16
from itertools import product
print(next(p for p in reversed(sorted(i*j for i,j in product(range(100,999),range(100,999)))) if list(str(p))==list(reversed(str(p)))))
# properties.py
# test python properties!
import math
class LittleThing():
def __init__(self, state):