On September 1, 2022, GitHub Learning Lab will shut down.
Read more on the GitHub blog and check out GitHub Skills for courses backed by GitHub Actions.
See an up-to-date option for this page.

Introduction to Python

Go from Hello World to writing a short random quote generator using Python.

Start free course Join 26097 others!

social preview

Build a Python Quote Bot

This tutorial shows you how to build a simple quote bot in Python, even if you've never written any code before.

$ python get-quote.py

Keep it logically awesome

$ python get-quote.py

Speak like a human

Learn how to read from a text file of quotes, randomly choose one, and print it to your terminal.

Steps to complete this course 7
  1. Set up your environment

    Check that Python and Git are installed

  2. Hello World

    Run the classic first program in Python

  3. Change the primary function

    Learn how the main() thing works

  4. Read a file into an array

    Use file input to change your Python output

  5. Get the last element of an array

    Explore the quotes file and grab the last one

  6. Retrieve a random quote

    Use your array knowledge to print quotes at random

  7. Explore Python on your own

    Some ideas for next steps

Share Introduction to Python
Average time to complete

137 minutes


All public courses on Learning Lab are free.

Latest release

Users who took this course also took

What is GitHub Learning Lab?

Learn new skills by completing fun, realistic projects in your very own GitHub repository.

Ready to start learning?

Start Introduction to Python