10/20/2020: And now on to actual coding!¶
A collection of notes to go over in class, to keep things organized.
NOTE: I need to remember to start recording the session – so each class, feel free to pipe up and remind me!
And use the chat to inject questions: Subhiksha will be monitoring it.
Also: I’ll try to have a break every hour – ping me if I forget!
Lightning Talks¶
Up today:
Are you ready? We’ll do them somewhere in the middle of the lesson.
Introductions:¶
Your TA: Subhiksha Mukuntharaj
A few students that didn’t get a chance to introduce themsleves last class:
A tiny bit about yourself, your programming background, and why you want to learn Python. And your gitHub handle.
Sopheaktr L Danh
Nathan Marc Debard
Jin Han
James Roefs
Hua Shao
Quinn Yackulic
Getting set up, and Infrastructure¶
The primary goal of last week was to get you all set up to do development in Python. There were two components of that
1) Your Workstation Development Environment¶
You should all be now set up to run Create, Edit, and Run Python files, and have git running locally:
Programmer’s Text Editor with linting enabled.
Command line terminal: Terminal, DOS box, gitBash - Anyone try the new Windows Terminal?
git – run from cammand line, or Tortoise git, or …
cPython version 3.8.* or 3.9.*
Have all of you got that running?
(Zoom Poll ….)
2) git / gitHub Classroom¶
The second, and harder part is gitHub classroom.
Sorry about the false start – it was buggy!
But we’ve settled on a workflow, and hopefully it will suport that workflow consitently.
In general, most of you seem to have got the basics down:
Accepting the assignment
Cloning the assignment repo onto your machine.
Adding a file to git
Commiting your changes
Pushing your changes to gitHub.
Did you all get a gitHub Classroom repo working?
(zoom poll)
branching¶
Now we need to add one more step: creating a branch to work in.
The workflow you will be using in this class is published in the class “textbook” here:
https://uwpce-pythoncert.github.io/ProgrammingInPython/topics/01-setting_up/github_classroom.html
Let’s run through the process with the first “real” assignment:
Grid Printer
Can I have a Volunteer?
(you can all follow along … )
Notes:¶
git is very flexible, and does not lose data easily. However, it is much harder to undo things than it is to make changes. So you will be happier if you take some extra care to not commit changes that you don’t want. Some hints:
Always do a
git status
before you commit – make sure that the stuff you are going to commit is what you want!note that if you do
git commit
it will only commit those files listed under “staged for commit”. But if you dogit commit -a
(-a for all) then it will commit everything modified, i.e. “Changes not staged for commit:”.
Note in the status report:
$ git status
On branch master
Your branch is up to date with 'origin/master'.
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: notes_for_class/source/lesson02.rst
...
It even tells you want to do: use git add
to stage particular files, or git checkout
to revert a file back to its state as of the last commit. It doesn’t mention git commit -a
, but that will commmit everything that is “not staged for commit”.
If you are careful before the commit stage, then you won’t have to “roll back” changes very often.
But if you do:
There are other nifty hints on that page, if you get stuck.
Break Me¶
Most of you seemed to do fine making the few key exceptions – any questions?
Note:
We were not expecting you to catch the exceptions – we’re really starting at the bottom here, just making sure you get used to seeing common exceptions, and what they mean.
We’ll get into Exception handling later.
And yes, once you get a SyntaxError, nothing will run. That is the point. So commenting it out (or fixing it :-) ) after you get it fine.
Now some new stuff¶
Coding Bat¶
The coding bat sight is a great place to find some quick programming challeges:
Let’s do one – and then you can play around on your own.
Break Time!¶
10min break, then two more lightning talks:
Grid Printer¶
Get a start on your own, then we’ll come together and finish it up.
Fizz Buzz¶
Get a start on your own, then we’ll come together and finish it up.
Recursion¶
Get a start on your own, then we’ll come together and finish it up.
(seeing a pattern here?)