liveBook · Manning

Chapter 2: Getting started

What you will learn in chapter 2 of The Quick Python Book, Fourth Edition

The chapter introduces Google Colaboratory and the book’s GitHub code as a quick way to start running Python examples and lab exercises.

After this chapter you will be able to

Section by section

Introduction

The chapter introduces Google Colaboratory and the book’s GitHub code as a quick way to start running Python examples and lab exercises.

Key terms: Google Colaboratory, GitHub repository, code examples, lab exercises

2.1 Paradox of choice: Which Python?

The section introduces the growing range of ways to run Python and previews a survey of the options before the book’s use of Google Colaboratory.

2.1.1 Python versions

This section explains Python’s annual release schedule and how to choose a version that will work with the book.

Key terms: annual release cycle, Python 3.9, supported version, full releases, security fixes

2.1.2 Sources of Python

This subsection identifies ways to obtain Python and explains why readers can postpone choosing a local installation.

Key terms: python.org, Anaconda, app store, package manager, source code, local install

2.1.3 Devices, platforms, and operating systems

Python runs across many kinds of devices and environments, with implementations that extend beyond the common C-based one.

Key terms: devices, operating systems, processors, implementation, C language, Java

2.1.4 Environments and tools

This section surveys ways to write and run Python code, then explains what Jupyter notebooks add to those options.

Key terms: Python interpreter, IPython, IDE, Jupyter, notebook, Markdown, code cells

2.2 Colaboratory: Jupyter notebooks in the cloud

This section recommends Google Colaboratory for working through the book and explains how the book presents its code.

Key terms: Colaboratory, Jupyter notebooks, GitHub, text files

2.2.1 Getting the source notebooks

This section shows how to find the book’s chapter 2 notebook in its GitHub repository so you can get started with Colaboratory.

Key terms: GitHub repository, code directory, Chapter 02, Chapter_02.ipynb

2.2.2 Getting started with Colaboratory

This section shows how to open the book’s chapter 2 notebook in Colaboratory and explains when a Google account is required.

Key terms: Chapter_02.ipynb, Open in Colab, Open notebook, GitHub URL, Google account, Colaboratory, save sessions and files

2.2.3 Colaboratory’s Python version

This section explains why Colaboratory’s convenience outweighs the possibility that its Python version is slightly behind the latest release.

Key terms: Colaboratory, Python environment, Jupyter notebooks, Python version

2.3 Writing and running code in Colaboratory

Explains how to edit text cells and run code cells in a Colaboratory notebook, including where output appears and when changes are saved.

Key terms: Jupyter notebook, text cells, code cells, Markdown, edit mode, text mode, source notebooks, GitHub repository, Google account, Ctrl-Enter

2.3.1 Hello, World

This subsection runs a Hello, World example in a Colaboratory code cell and explains how the book distinguishes entered code from output.

Key terms: print(), code cell, Ctrl-Enter, output, normal-weight monospace, monospace bold

2.3.2 Dealing with errors in Jupyter

This section shows where Jupyter displays Python errors, how to read a simple syntax error, and why to review Colaboratory’s suggested fixes.

Key terms: code cell, error message, syntax error, caret, incomplete input, Colaboratory, Fix Error, suggested fix

2.4 Using help and dir to explore Python

This section shows how to explore Python’s built-in documentation with help() and inspect names with dir().

Key terms: help(), help system, help> prompt, dir(), namespace, current global namespace, members

2.5 Using AI tools to write Python code

This section introduces AI code-generation tools as useful but unreliable aids that still require human understanding.

Key terms: large language model–based tools, text prompt, AI-generated solutions, human understanding

2.5.1 Benefits of AI tools

This section explains two practical benefits of AI code generation: speed and fewer typing mistakes.

Key terms: AI code generation, prompt, chatbot

2.5.2 Negatives of using AI tools

This section explains the environmental, privacy, cost, and code-quality drawbacks to weigh before using AI-generated code.

Key terms: AI-generated code, review and testing, bugs and inefficiencies, sharing your code, other’s code, privacy, intellectual property, energy and water, resources, free of charge

2.5.3 AI options

This section compares AI code-generation options for the book’s exercises and explains why using one is optional.

Key terms: Colaboratory, GitHub Copilot, VSCode IDE, local version of Python, AI tool, source notebooks

2.6 Summary

Where this is used later

Concepts explained in this chapter

← Chapter 1: About Python Chapter 3: The quick Python overview →

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.