Version Control

Git & GitHub

Every software engineer uses Git. These resources get you started with version control so you can track changes, collaborate, and build a portfolio.

git init # start a new repo git clone <url> # copy a repo from GitHub git status # see what's changed git add . # stage all changes git commit -m "message" # save a snapshot git push origin main # push to GitHub git pull # get latest from remote git branch feature-name # create a new branch
Practice Labs

CodeCheck Assignments

CodeCheck.io gives you instant feedback on your code. These labs are used in class — practice them as much as you want.

Reference

Regex Cheat Sheet

Character Classes
  • . — any char except newline
  • \d — digit [0-9]
  • \D — non-digit
  • \w — word char [a-zA-Z0-9_]
  • \W — non-word char
  • \s — whitespace
  • \S — non-whitespace
Quantifiers
  • * — 0 or more
  • + — 1 or more
  • ? — 0 or 1 (optional)
  • {n} — exactly n times
  • {n,m} — between n and m
  • ^ — start of string
  • $ — end of string
Python re Module
  • re.match(p, s) — at start
  • re.search(p, s) — anywhere
  • re.findall(p, s) — all matches
  • re.sub(p, r, s) — replace
  • re.compile(p) — compile
Groups & Anchors
  • (abc) — capture group
  • (?:abc) — non-capture
  • a|b — a or b
  • [abc] — any of a, b, c
  • [^abc] — not a, b, or c
  • \b — word boundary
Advanced Topic

References & Pointers in Python

Python doesn't have pointers like C/C++, but it uses references. Every variable holds a reference to an object, not the object itself.

# Both variables point to the SAME list a = [1, 2, 3] b = a # b is a reference to the same object b.append(4) print(a) # [1, 2, 3, 4] ← a changed too! # Use .copy() or list() to avoid this c = a.copy() c.append(99) print(a) # [1, 2, 3, 4] ← a unchanged