- Each iteration will be 35 minutes of coding, followed by a 15 minute retro, followed by a 10 minute break.
- We will be working in pairs and using test-driven development (TDD). Pairs switch after each iteration.
- After each iteration, we will start from scratch - delete your code! The goal is the practice, not the code.
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
# Problem 4-2 | |
class edXPerson(Person): | |
nextIdNum = 0 | |
def __init__(self, name): | |
Person.__init__(self, name) | |
self.idNum = edXPerson.nextIdNum | |
edXPerson.nextIdNum += 1 | |
def getIdNum(self): | |
return self.idNum | |
def __lt__(self, other): |
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
# Problem 2: SimpleVirus and Patient | |
class SimpleVirus(object): | |
def __init__(self, maxBirthProb, clearProb): | |
self.maxBirthProb = maxBirthProb | |
self.clearProb = clearProb | |
def getMaxBirthProb(self): | |
return self.maxBirthProb |
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
# 1. RectangularRoom | |
class RectangularRoom(object): | |
def __init__(self, width, height): | |
self.width, self.height = width, height | |
self.tiles = dict(((x, y), 0) for x in range(width) for y in range(height)) | |
def cleanTileAtPosition(self, pos): | |
self.tiles[(int(pos.x), int(pos.y))] += 1 | |
def isTileCleaned(self, m, n): |
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
# 1. NewsStory | |
class NewsStory(object): | |
def __init__(self, guid, title, subject, summary, link): | |
self.guid = guid | |
self.title = title | |
self.subject = subject | |
self.summary = summary | |
self.link = link | |
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
# 3. Iterative/recursive log function | |
def myLog(x, b): | |
a = 0 | |
while b ** a <= x: | |
a += 1 | |
return a - 1 | |
# 4. Interlace two strings iteratively | |
def laceStrings(s1, s2): | |
shorter, longer = sorted([s1, s2], key=len) |
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 string | |
# 1. Polynomials | |
def evaluatePoly(poly, x): | |
return float(sum(b * (x ** a) for a,b in enumerate(poly))) | |
# 2. Derivatives | |
def computeDeriv(poly): | |
return [float (a * b) for a, b in enumerate(poly)][1:] or [0.0] |
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
var cell = new Array(3); | |
for (i = 0; i < 3; i++) { | |
cell[i] = new Array(3); | |
} | |
var newCell = new Array(3); | |
for (i = 0; i < 3; i++) { | |
newCell[i] = new Array(3); | |
} |
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
#! /usr/bin/env python3 | |
"""Simulate the probability of a reward in R6 Siege.""" | |
from argparse import ArgumentParser | |
import random | |
from textwrap import dedent | |
from typing import Mapping | |
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
2019/04/05 12:38:38 [INFO] Terraform version: 0.11.8 7a5c1d221ac209bbac66947c369815cd9ca70ed5 | |
2019/04/05 12:38:38 [INFO] Go runtime version: go1.10.1 | |
2019/04/05 12:38:38 [INFO] CLI args: []string{"/home/circleci/base/e2e/terraform", "apply", "-auto-approve"} | |
2019/04/05 12:38:38 [DEBUG] Attempting to open CLI config file: /home/circleci/.terraformrc | |
2019/04/05 12:38:38 [DEBUG] File doesn't exist, but doesn't need to. Ignoring. | |
2019/04/05 12:38:38 [INFO] CLI command args: []string{"apply", "-auto-approve"} | |
2019/04/05 12:38:38 [INFO] command: empty terraform config, returning nil | |
2019/04/05 12:38:38 [DEBUG] command: no data state file found for backend config | |
2019/04/05 12:38:38 [DEBUG] New state was assigned lineage "e48ff2b8-ddfe-882d-6ef9-9fbc2bf7e882" | |
2019/04/05 12:38:38 [INFO] command: backend initialized: <nil> |