Week 2 · Session 2
Git workflow, variables, operators, and Lab 1.
Saving Your Work
Only the first time you use git on a new computer.
git config --global user.email "you@allegheny.edu"git config --global user.name "Your Name"Saving Your Work
Three commands, every time you save progress to GitHub.
git add . — stage every changed filegit commit -m "message" — save a snapshotgit push — upload it to GitHubSaving Your Work
Same three steps, with buttons instead of typing.
git addgit commitYour first Python.
trip_miles = 450 — the name goes on the left, the value on the right. = means store this, not equalitym tells nobody anything; trip_miles tells them everythingint (26), float (3.79), str ("Wednesday"), bool (True/False)print(f"Trip: {trip_miles} miles")Always. Even when the user types a number.
input() pauses the program, waits for the user to type a line and press Enter, then hands back what they typedage = input("How old? ") then typing 19 stores "19", not 19"19" + 1 is an error. Convert first: age = int(input("How old? "))Run the code below. Fix it. Break something else on purpose.
int() and read that error tooThe operators Lab 1 runs on.
+ - * — the ones you already know. / always gives a float: 10 / 5 is 2.0// — integer division, throws away the remainder: 2026 // 100 is 20% — modulo, keeps only the remainder: 11 % 7 is 4. Anything that wraps around (clocks, weekdays) is modulo"1-23-2026".split("-") gives ["1", "23", "2026"] — every piece is still a string, convert before you calculate145 minutes is 2 hours and 25 minutes. Two operators are wrong.split("-") on the last lineReleased Today
Due Friday, September 11.
DayFunctions.pygit add ., commit, pushuv run gatorgrade --config gatorgrade.yml before you consider it done, and book a code review early