Intro to Python

Learning Goals

  1. Explain why Python is a good language for teaching computational competence.
  2. Write and execute simple Python programs that use functions, loops, indexing, conditionals, defensive programming, files, and lists, tuples, sets, and dictionaries.
  3. Explain the DRY principle.

Python? What? Why? How?

Digging In

We're going to interactively work through the collection of IPython notebooks below. To get the notebooks and all of the supporting files, please download this python-intro.zip archive, and unzip it in the bootcamp repo that you setup during the Intro to Version Control and Git lesson. Doing that should create a python-intro directory that you can add and commit to your repo.

Now cd into the python-intro directory and launch ipython notebook.

  • Basic Python
  • Functions
    • The python-1-functions notebook covers defining and calling functions in Python and the call stack
  • Loops and Indexing
  • Conditionals and Defensive Programming
  • Files and Lists
    • The python-4-data-types notebook introduces 4 of Python's compound data types: list, tuple, set, and dictionary (or dict)

Here are the exercise notebooks that were created during the sessions. They are sparse compared to the annotated notebooks above, but they are the live-coding, hands-on work that we did:

References

Back to Topics