This file contains hidden or 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
<html xmlns="http://www.w3.org/1999/xhtml"> | |
<head> | |
<title>stackoverflow.com wants you to log in</title> | |
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script> | |
<script type="text/javascript" src="/Content/js/master.js?v=KRhVz2Mn3x%2faPbHHCaUUH2w8vn0%3d"></script> | |
<link rel="stylesheet" type="text/css" href="/Content/css/all.css?v=KRhVz2Mn3x%2faPbHHCaUUH2w8vn0%3d"> | |
<script type="text/javascript">common.bustFrames();</script> | |
<link rel="openid.server" href="https://openid.stackexchange.com/openid/provider"> | |
<link rel="openid2.provider" href="https://openid.stackexchange.com/openid/provider"> | |
</head> |
This file contains hidden or 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
<html> | |
<head> | |
<title>Stack Overflow</title> | |
<link rel="shortcut icon" href="//cdn.sstatic.net/Sites/stackoverflow/img/favicon.ico?v=4f32ecc8f43d"> | |
<link rel="apple-touch-icon image_src" href="//cdn.sstatic.net/Sites/stackoverflow/img/apple-touch-icon.png?v=c78bd457575a"> | |
<link rel="search" type="application/opensearchdescription+xml" title="Stack Overflow" href="/opensearch.xml"> | |
<meta name="twitter:card" content="summary"> | |
<meta name="twitter:domain" content="stackoverflow.com"> | |
<meta property="og:type" content="website"> | |
<meta property="og:image" itemprop="image primaryImageOfPage" content="http://cdn.sstatic.net/Sites/stackoverflow/img/[email protected]?v=73d79a89bded&a"> |
This file contains hidden or 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
s = '1321131112' | |
for n in xrange(0, 50): | |
chains = [] | |
chain = s[0] | |
prev = s[0] | |
part = s[1:] | |
for index, c in enumerate(part, start=1): | |
if c == prev: |
This file contains hidden or 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
s = '1321131112' | |
for n in xrange(0, 40): | |
chains = [] | |
chain = s[0] | |
prev = s[0] | |
for index, c in enumerate(s[1:], start=1): | |
if c == prev: | |
chain += c | |
else: |
This file contains hidden or 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
ticker = { | |
'children': 3, | |
'cats': 7, | |
'samoyeds': 2, | |
'pomeranians': 3, | |
'akitas': 0, | |
'vizslas': 0, | |
'goldfish': 5, | |
'trees': 3, | |
'cars': 2, |
This file contains hidden or 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
ticker = { | |
'children': 3, | |
'cats': 7, | |
'samoyeds': 2, | |
'pomeranians': 3, | |
'akitas': 0, | |
'vizslas': 0, | |
'goldfish': 5, | |
'trees': 3, | |
'cars': 2, |
This file contains hidden or 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
processed_lines = [] | |
known_keys = [] | |
mapping = {} | |
def is_entire_lhand_known(line): | |
ops = ('OR', 'AND', 'NOT', 'LSHIFT', 'RSHIFT') | |
keys = [] | |
for part in [x.strip() for x in line[:line.index('->')].split()]: | |
if part not in ops and not part.isdigit(): | |
keys.append(part) |
This file contains hidden or 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 json | |
total = 0 | |
def traverse_list(l): | |
global total | |
for item in l: | |
if isinstance(item, int): | |
total += item | |
elif isinstance(item, str): |
This file contains hidden or 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 json | |
total = 0; | |
def traverse_list(l): | |
global total | |
for item in l: | |
if isinstance(item, int): | |
total += item | |
elif isinstance(item, str): |
This file contains hidden or 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
santa_x, santa_y = 0, 0 | |
robot_x, robot_y = 0, 0 | |
visited_santa = [(santa_x, santa_y)] | |
visited_robot = [(robot_x, robot_y)] | |
with open('day3.txt', 'r') as f: | |
s = f.readline() | |
santas_turn = True | |
for direction in s: | |
if santas_turn: |