Note that this site is in currently in version 1.0.0-alpha.   Some functionality may be limited.

Introduction to Python

Theory to Practice

Congratulations on completing the Intro to Python workshop! So far, you’ve learned quite a bit about variables, functions, loops, modules, and other foundational concepts to further your Python journey. For next steps, consider our suggested introductoin to Python libraries, or trying some of the tutorials or projects listed below. Maybe you want to learn how to clean text with Regex, or want to dig into web scraping with the Python library requests . Or, if you are interested in strengthening your foundational skills, read one of the most suggested (and free!) beginner Python book,  How to Think Like a Computer Scientist - Python Edition. See a full list of our suggestions below.

Review your knowledge: 10 questions from the lessons

Try again!

If we wanted to make a string like 'hello' uppercase, we would use the method upper(), in the following way:

(Select one of the following)

Try again!

Why would someone use dir()? Select all that apply:

Try again!

If you get an error, what can you do to debug it? Select all that apply:

Try again!

What are the differences between the terminal, REPL, and text editor? Select the correct statement from the below options.

(Select one of the following)

Try again!

How would you get Python to print the length of the last book in the list? Hint: this number reflects the length of the string which is the last item in the list. Choose the correct expression from the options below.

(Select one of the following)

Try again!

What is a module? Select all that apply:

Try again!

Select all the variable expressions that are allowed in Python.

(Select all that apply)

Try again!

Select all the following that accurately describe the data type categories.

(Select all that apply)

Try again!

If we wanted to calculate the length of an input using len(), how would we write that expression?

(Select one of the following)

Try again!

What are different ways for describing what a “for loop” can do?

(Select all that apply)

Deepen your knowledge

Discussion Questions

  • What kind of data types are available? What is the difference between a string and a list? Why do these differences matter?

  • Describe the process of using both a text editor and a terminal to write and execute Python scripts.

  • How do you write a program that can “make decisions” based on certain conditions? What are the parts that you would need?

  • In what ways does the internet (using google) help someone to use and learn Python?

  • What are “libraries” or “modules”, where do they come from, and what are they used for?


DHRI workshops provide a foundational comprehension of digital skills and tools often used in digital humanities and humanistic social science research. While having a strong foundation is important, there is usually more to learn if you want to get started on your own. Now that you have an awareness of the basics, here are some other tutorials to try that will extend your learning.

Google’s Python Class

If you feel like you’re ready for more tutorials, you should check out Google’s Python Class, a solid introduction that also begins to explore intermediate concepts and modules.

Python Programming for the Humanities

To begin using Python for manipulating and analyzing text based data, check out Python Programming for the Humanities, and jump straight into chapter 2.

How to Think Like a Computer Scientist - Python Edition

For those interested in more general computer science concepts, How to Think Like a Computer Scientist - Python Edition offers a good introduction to python.

Hacking the Humanities

If you learn best by watching videos, Paul Vierthaler’s recorded and uploaded his DH class, Hacking the Humanities, to Youtube. Includes a general introduction to coding principles, introduction to python, with emphasis on text analysis, data manipulation, and web scraping.

Learn Python the Hard Way

If you learn best by copying and practicing, Learn Python the Hard Way, by Zed A. Shaw, is an excellent a hands-on resource. Although the online and print book versions cost money, you can test out a sample for free.

Further Readings

After they complete a workshop, participants often ask: what next? Here are some additional resources that can help you think about the projects that could be developed, the resources that you might need, the ways this skill could be used in the classroom, or debates in the field of digital humanities that provide context to what you have just learned.

How Do I Solve [insert problem here] With Python?

Hannah Aizenman, a former Digital Fellow, wrote up a great blog post introducing python “libraries,” or collections of python code, for various project types, from creating a website, to getting, exploring, and visualizing data, and working with images, video, spreadsheets, among other ideas. Check out her suggestions in How Do I Solve [insert problem here] With Python?

Projects or Challenges to Try

Automate the Boring Stuff

Automate the Boring Stuff contains many little projects for strengthening beginner and intermediate python skills. You might play around with regular expressions (or regex), which is a method for locating and manipulating certain patterns of text (think of it like a high powered ctrl-F). Once you feel more comfortable with regex, you might write a program that organizes or renames the files on your computer. Just be sure to practice with a sample folder & files before moving on to your own documents!


Interested in web scraping (aka grabbing information from the web)? The python library requests handles requests over the internet. See this handy step-by-step tutorial on Real Python.

Visualizing Data with Bokeh and Pandas

Advanced Challenge: This is more complicated stuff, but if you’re interested in working with CSV data and visualization techniques, you might check out Python libraries for data analysis, like Bokeh and Pandas. See Programming Historian’s Visualizing Data with Bokeh and Pandas for a tutorial. To learn more about Pandas from the ground up, check out Learn Data Science’s useful introduction.