Home   |    Blog   |    Contact

Conquer Programming by Learning Python

Programming is a hugely useful skill...and it's frustratingly hard to learn, especially on your own.

Class details

Audience: People new to programming. No experience with either programming or Python is required.

Length: 2-5 days, depending on options chosen. Where possible, doing them in half-day segments tends to work best for new programmers, keeping them from being overwhelmed and giving them time to absorb things. The two-day option will introduce people to programming and is useful in time-constrained circumstances, but in my experience if you actually want to turn a student into a real programmer, they need more time and practice. So I recommend a minimum of three days.

Approach: Each topic starts with a very interactive, discussion-based lecture where I do live coding to explain concepts, punctuated by short student exercises to help students absorb the mechanics. These are followed by more challenging team-based exercise projects that combine two or three concepts to accomplish a realistic programming task. We regularly review the concepts learned so far and students have plenty of opportunity to ask about anything that needs more discussion. Students receive book-length HTML and Jupyter Notebook files of the entire class content.

Curriculum

Fundamentals (2 days)

Part 1: Programming

  • Variables: What they are, and Python's unique approach
  • Strings: Text for humans
  • Functions: The building block of scripts
  • If This Then That: Python code blocks and if/else statements
  • Objects: Everything in Python is an object -- what does that mean, and how do you work with objects?
  • Lists: Python is a language about lists

Part 2: Scripting

  • Review of Part 1, with a team exercise
  • Scripts: What they are, and how to use comments
  • Importing code: Making use of libraries
  • Formatting text: How to make your human-oriented output look good
  • Files: Basic reading and writing

Part 3: Parsing

  • Review of Parts 1-2, with team exercise
  • Parsing strings: Basic yet powerful techniques for parsing string input without using regular expressions
  • CSV: Using the built-in CSV module to parse spreadsheet data
  • Sorting lists
  • Sets: Usually overlooked in tutorials, sets help solve many common problems

Part 4: Reporting

  • Review of Parts 1-3, with a team exercise
  • Lists redux: Let's really nail this list stuff
  • Dictionaries: A fancy kind of list that is like a little database
  • Counter: Using libraries to solve problems
  • Final exercise: Parse a spreadsheet, crunch the data, and write out a report

Optional topics

You can pick and choose among these based on your needs.

Regular Expressions

  • An overview of regular expressions and how they work in Python
  • Class exercises where we walk through solving a couple of typical parsing scenarios with regular expressions
  • Optionally, a deeper dive into regular expressions, for students who will be doing a lot of text parsing

Unicode

  • A fun (really!) review of the history of Unicode and why it came about
  • A compelling demonstration of why Absolutely Every Programmer Should Understand Unicode
  • A clear set of simple guidelines for how to handle Unicode and solve problems

Students are always surprised at how interesting this topic is (hey, I even discuss Klingon!), and they find that handling Unicode is actually quite easy if you understand what it's about.

Data Science

  • Overview of data science support in Python
  • Introduction to using Pandas to parse tabular data
  • Examples of using the Pandas Series class to solve typical programming problems
  • JSON parsing
  • Databases: How to use the sqlite3 library to interact with a database

Automation and Workflow

  • Command-line operations in Python: executing other scripts, etc.
  • File handling: Copying and moving files around
  • Websites: Accessing websites, using JSON
  • Packaging code: How to create libraries for you and your team

Object-Oriented Programming

  • Creating basic objects: What is this 'self' thing?
  • Accessing built-in Python functionality: The 'dunder' methods
  • Using inheritance to streamline code

This is a relatively basic overview of Object-Oriented Programming, which is all that 99% of students usually need. We don't cover more advanced topics like Properties, Decorators, and static methods, unless the students have a particular need for more extended coverage.