Monday Videos
Posted on Aug 17th, 2020
Videos
- Monday Morning Video
- Password: H7$fhV+7
- Monday Afternoon Video
- Password: ypB+1LaS
Posted on Aug 17th, 2020
Posted on Aug 13th, 2020
Posted on Aug 13th, 2020
Breaking down programming problems into their smallest pieces is one of the most critical skills in programming. You’ll need to practice this for the weekend assignment.
import
Developers need to sketch out their ideas. (This is the true purpose of whiteboards for engineering teams, not grilling job candidates on obscure algorithms!) A pencil and paper is a great tool for programming. If that isn’t your style, use a stylus and tablet, a Google Doc, or whatever you like to jot things down. Don’t start in the code editor, in other words!
Get the contents of a file
Figure out some way to choose a random word
Keep track of what letters have been guessed
Once you have a plan you think is somewhat doable, then you can start writing code. Work through your steps in the order that makes sense, keeping in mind that you can hard code values as placeholders where you need to.
You must run your program repeatedly to get feedback about what is happening.
Change one thing at a time and work methodically.
Take breaks.
Talk to other developers when you are stuck. Talking through the problem will often clarify what you need to do. See Rubber Duck Debugging.
Don’t forget to use your print statements to give you necessary information as your program runs.
if __name__ == "__main__"
do?
Posted on Aug 12th, 2020
Posted on Aug 12th, 2020
In response to some questions this afternoon, I put together a list of Python builtin functions and keywords. Because there are a LOT of keywords and builtin functions, I’ve tried to pare these down to those we’re going to be using or otherwise most likely to encounter (I’ve included links to the full lists at the bottom of this document.
In the table below, ‘constructors’ will return an object of the indicated type, ‘sequences’ will return a sequence we can use in a for loop, ‘tests’ will return True or False, input/output will interact with external resources, and ‘general’ fall into none of the above categories.
constructors | sequences | general | tests | input/output |
---|---|---|---|---|
list |
range |
len |
callable |
print |
str |
zip |
max |
isinstance |
input |
dict |
enumerate |
min |
hasattr |
open |
tuple |
sum |
exit |
||
int |
type |
|||
float |
||||
In the table below, ‘looping’ keywords introduce a block that will be repeated some number of times, ‘conditional’ keyword separate blocks that should only be executed conditionally, ‘expression’ keywords produce a value (so far these are all booleans), and ‘other’ is a catchall for keywords that introduce other kinds of blocks.
looping | conditional | expression | other |
---|---|---|---|
for/in |
if |
in |
def |
while |
elif |
not |
class |
else |
and |
with/as |
|
or |
try |
||
except |
|||
import |
|||
raise |
|||
All of these modules are in the Python Standard Library. The column heading indicates the subject of the module.
operating system | math utilities | data processing and storage | utilities |
---|---|---|---|
os | math | pickle | string |
sys | statistics | json | datetime |
pathlib | random | csv | collections |
pdb | |||
-Full List of Python Builtin Functions, with Documentation -Full List of Python Keywords -Python Keyword/Language Documentation -List of Python Standard Library Modules, with Documentation