Introduction to Python

Description

Python is a general-purpose programming language suitable for a wide variety of tasks in the digital humanities. Learning Python fundamentals is a gateway to analyzing data, creating visualizations, composing interactive websites, scraping the internet, and engaging in the distant reading of texts. This workshop first introduces participants to core programming concepts such as data types, variables, and functions. Participants will then learn about basic control flow by writing small programs with loops and conditional statements. They will also learn to problem solve, and practice searching for answers and debugging scripts. The workshop wraps up by exposing participants to intermediate tools for further exploration.

Table of Contents

    1. Frontmatter

    2. Interacting With Python

    The Interactive Session / A Little Math / Opening the REPL in the Terminal / Challenge / ...

    3. Types

    Challenge / What's the deal with type()? / Challenge / Evaluation

    4. Variables

    Challenge / Evaluation

    5. Running Scripts

    Your First Script / Running A Script Locally with the Terminal and a Text Editor / A Note on Text / Challenge / ...

    6. Errors in Python

    Two Kinds of Errors / Debugging / Challenge / Evaluation

    7. Functions

    Writing your first function / Writing your second function / Challenge / Evaluation

    8. Lists

    List Indexing / Slicing Lists / Challenge / Evaluation

    9. Loops

    A Note on Variable Names / Challenge / Evaluation

    10. Conditionals

    Challenge / Evaluation

    11. Working With Input

    Challenge / Evaluation

    12. Doing Things to Lists

    Challenge / Evaluation

    13. Finding Answers with Google

    Implementing Our Answer / Challenge / Evaluation

    14. A Little Motivation

    Importing a module / Challenge / Evaluation

    15. Objects in Python

    Examining Objects / Challenge

    16. Theory to Practice

    Suggested Further Readings and Tutorials / Discussion Questions