---
title: "Overview"
space: "Student Handbook"
url: "https://portal.cs17.org/student-handbook/python-manual/overview"
updated: "2026-10-05"
---

A short reference for the Python you use in cs17. Each page covers one function or idea, in plain words, with an example you can run and the mistake people make most often.

## How to read a page

| Section | What it tells you |
| --- | --- |
| Synopsis | How to write the call. Words in the call, like `value`, are placeholders. |
| Description | What it does, and anything surprising. |
| Parameters | What each value in the parentheses means. |
| Return value | What you get back, and its type. |
| Example | Code and exactly what it prints. Typed answers to `input` are shown after the prompt. |
| Common mistake | Code that goes wrong, what Python says, and the fix. |

Every example was run with Python 3.12, the version on your laptop, so the output and error messages match what you will see.

Want more detail? Every page links to the official [Python documentation](https://docs.python.org/3/). You can also type `help(print)` at the Python prompt: run `python3` with no file name, and leave with `exit()`.

## Built-in functions

Functions that are always there. You never import them.

| Name | What it does |
| --- | --- |
| [print](/student-handbook/python-manual/built-in-functions/print) | Shows values on the screen. |
| [input](/student-handbook/python-manual/built-in-functions/input) | Asks the user to type something, and returns it as a string. |
| [int](/student-handbook/python-manual/built-in-functions/int) | Converts a value to a whole number. |
| [float](/student-handbook/python-manual/built-in-functions/float) | Converts a value to a number with a decimal point. |
| [str](/student-handbook/python-manual/built-in-functions/str) | Converts a value to a string (text). |
| [type](/student-handbook/python-manual/built-in-functions/type) | Tells you the type of a value. |
| [len](/student-handbook/python-manual/built-in-functions/len) | Returns how many items a string or list has. |
| [range](/student-handbook/python-manual/built-in-functions/range) | Makes a sequence of whole numbers, most often for a `for` loop. |
| [round](/student-handbook/python-manual/built-in-functions/round) | Rounds a number. |
| [abs](/student-handbook/python-manual/built-in-functions/abs) | Returns how far a number is from zero. |
| [min](/student-handbook/python-manual/built-in-functions/min) | Returns the smallest of several values. |
| [max](/student-handbook/python-manual/built-in-functions/max) | Returns the largest of several values. |
| [sum](/student-handbook/python-manual/built-in-functions/sum) | Adds up all the numbers in a list. |

## Strings

Working with text. Most of these are methods, called with a dot: `text.lower()`.

| Name | What it does |
| --- | --- |
| [f-strings](/student-handbook/python-manual/strings/f-strings) | Puts values into text. |
| [str.lower](/student-handbook/python-manual/strings/lower) | Returns a copy of a string in lowercase. |
| [str.upper](/student-handbook/python-manual/strings/upper) | Returns a copy of a string in capitals. |
| [str.strip](/student-handbook/python-manual/strings/strip) | Removes spaces (or other characters) from both ends of a string. |
| [str.split](/student-handbook/python-manual/strings/split) | Breaks a string into a list of parts. |
| [str.join](/student-handbook/python-manual/strings/join) | Joins a list of strings into one string. |
| [str.replace](/student-handbook/python-manual/strings/replace) | Returns a copy of a string with one piece of text swapped for another. |
| [str.startswith](/student-handbook/python-manual/strings/startswith) | Checks how a string begins (or, with `endswith`, how it ends). |
| [in](/student-handbook/python-manual/strings/in) | Checks whether a piece of text, or an item, is inside another. |

## Lists

A list holds several values in order: `[3, 1, 2]`.

| Name | What it does |
| --- | --- |
| [list.append](/student-handbook/python-manual/lists/append) | Adds an item to the end of a list. |
| [list.pop](/student-handbook/python-manual/lists/pop) | Removes an item from a list and returns it. |
| [list.sort](/student-handbook/python-manual/lists/sort) | Puts a list in order. |
| [Indexing and slicing](/student-handbook/python-manual/lists/indexing-and-slicing) | Gets one item, or a range of items, from a string or list by position. |

## math

Maths beyond `+ - * /`. Start the file with `import math`.

| Name | What it does |
| --- | --- |
| [math.sqrt](/student-handbook/python-manual/math/sqrt) | Returns the square root of a number. |
| [math.floor](/student-handbook/python-manual/math/floor) | Rounds a number down. |
| [math.ceil](/student-handbook/python-manual/math/ceil) | Rounds a number up. |

## random

Random numbers and choices, for games and simulations. Start the file with `import random`.

| Name | What it does |
| --- | --- |
| [random.randint](/student-handbook/python-manual/random/randint) | Picks a random whole number between two numbers. |
| [random.choice](/student-handbook/python-manual/random/choice) | Picks a random item from a list or a string. |
