Skip to content

Instantly share code, notes, and snippets.

View maryrosecook's full-sized avatar

Mary Rose Cook maryrosecook

View GitHub Profile
# Use test-driven development to write a method that:
# * Takes an array of numbers.
# * Returns the sum of the numbers in the array.
# * e.g.
# * Input: [1, 2, 3, 4, 5]
# * Return: 15
# * Make sure to create a separate project directory for your code.
# Use test-driven development to write a method that:
# * Takes an array of numbers.
# * Returns an array of the same numbers, except each number has had 1 added to it.
# * e.g.
# * Input: [1, 2, 3, 4, 5]
# * Return: [2, 3, 4, 5, 6]
# * Make sure to create a separate project directory for your code.
OVERVIEW OF THE WEEK
- Encapsulating Single Responsibilities (rather than just common behaviour) into classes
- makes code easy to reuse
- makes code easy to change
- makes code easy to understand
- Refactoring code for SRP
- Adopt this code writing process

Responding to a student's request for help

Process

  1. Map the student's request for help to one of the underlying problems listed below.

  2. Apply one of the suggested solutions.

  3. Ask the student for feedback on your help.

@maryrosecook
maryrosecook / ...
Last active September 13, 2018 18:17
Reminders to myself to help me get better at programming. I don't always manage to do these things, but I try. Please feel free to add your own reminders to yourself in the comments below!
We couldn’t find that file to show.
to_dos = {"Haircut": False}
def print_to_dos(to_dos):
for to_do in to_dos:
if to_dos[to_do] == False:
print("- %s" % to_do)
else:
print("x %s" % to_do)
def new_to_do(to_dos):
to_do = raw_input("What else do you need to do? ")
(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/")
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)
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