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 maryrosecook on github. | |
* I am maryrosecook (https://keybase.io/maryrosecook) on keybase. | |
* I have a public key whose fingerprint is 59DB 7EF4 2BAC 5D67 22FB F7DA 7DFF 4628 A3F1 83AF | |
To claim this, I am signing this object: |
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
shopping_list = ["apple", "toothbrush", "banana", "black lava"] | |
shopping_list.append("cheese") | |
shopping_list.reverse() | |
print("Shopping List") | |
for shopping_list_item in shopping_list: | |
if len(shopping_list_item)<7 or shopping_list_item=="black lava": | |
print("-" + shopping_list_item) |
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
# shopping_list = ["apple", "toothbrush", "banana", "black lava"] | |
# shopping_list.append("cheese") | |
# shopping_list.reverse() | |
# print("Shopping List") | |
# for shopping_list_item in shopping_list: | |
# if len(shopping_list_item)<7 or shopping_list_item=="black lava": | |
# print("-" + shopping_list_item) | |
# if (shopping_list_item.get("done")==False): | |
# print ("-" + shopping_list_item.get("name")) | |
# else: |
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
# Unfunctional version: | |
names = ['Mary', 'Isla', 'Sam'] | |
''' | |
for i in range(len(names)): | |
names[i] = hash(names[i]) | |
print names # => [6306819796133686941, 8135353348168144921, -1228887169324443034] | |
''' |
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
people = [{'name': 'Mary', 'height': 160}, | |
{'name': 'Isla', 'height': 80}, | |
{'name': 'Sam'}] | |
""" | |
height_total = 0 | |
height_count = 0 | |
for person in people: | |
if 'height' in person: | |
height_total += person['height'] |
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 zero(s): | |
if s[0] == "0": | |
return s[1:] | |
def one(s): | |
if s[0] == "1": | |
return s[1:] | |
""" | |
def rule_sequence(s, rules): |
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
bands = [{'name': 'sunset rubdown', 'country': 'UK', 'active': False}, | |
{'name': 'women', 'country': 'Germany', 'active': False}, | |
{'name': 'a silver mt. zion', 'country': 'Spain', 'active': True}] | |
def assoc(_d, key, value): | |
from copy import deepcopy | |
d = deepcopy(_d) | |
d[key] = value | |
return d |
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
bands = [{'name': 'sunset rubdown', 'country': 'UK', 'active': False}, | |
{'name': 'women', 'country': 'Germany', 'active': False}, | |
{'name': 'a silver mt. zion', 'country': 'Spain', 'active': True}] | |
def assoc(_d, key, value): | |
from copy import deepcopy | |
d = deepcopy(_d) | |
d[key] = value | |
return d | |
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
to_dos = ["Haircut"] | |
def print_to_dos(to_dos): | |
for to_do in to_dos: | |
print("- %s" % to_do) | |
def new_to_do(to_dos): | |
to_do = raw_input("What else do you need to do? ") | |
to_dos.append(to_do) |
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
(require 'package) | |
(add-to-list 'package-archives | |
'("marmalade" . | |
"http://marmalade-repo.org/packages/")) | |
(add-to-list 'package-archives | |
'("melpa" . "http://melpa.milkbox.net/packages/") t) | |
(package-initialize) | |
;; load paths | |
(add-to-list 'load-path "~/.emacs.d/src/") |
OlderNewer