str.upper()StringsReturn a new uppercase string.
"python".upper() # PYTHON
Search the corrected method tables, operators, errors, file modes, built-ins, and environment commands derived from the course PDF.
str.upper()StringsReturn a new uppercase string.
"python".upper() # PYTHON
str.split(sep)StringsSplit text into a list at each separator.
"a,b".split(",") # ["a", "b"]sep.join(items)StringsJoin string items with a separator.
"-".join(["a", "b"]) # a-b
list.append(x)ListsAdd one item at the end; mutates the list.
items.append("Python")list.extend(values)ListsAdd every item from another iterable.
[1].extend([2, 3])
sorted(values)ListsReturn a sorted list without mutating the input.
sorted([3, 1, 2])
A & BSetsIntersection: values present in both sets.
{1, 2} & {2, 3} # {2}A | BSetsUnion: values present in either set.
{1, 2} | {2, 3}dict.get(key, default)DictionariesRead a key safely with a fallback.
profile.get("phone", "N/A")dict.items()DictionariesIterate over key-value pairs.
for key, value in data.items(): ...
// and %OperatorsFloor division and remainder.
17 // 5 == 3; 17 % 5 == 2
in / not inOperatorsTest whether a collection contains a value.
"Py" in "Python"
ValueErrorErrorsA value has the right broad type but invalid content.
int("hello")KeyErrorErrorsA dictionary lookup used a missing key.
{}["missing"]with open(...)FilesOpen a file and guarantee cleanup after the block.
with open("data.txt") as file: ...r / w / a / xFilesRead, replace-write, append, and create-only modes.
open("log.txt", "a")enumerate(iterable)Built-insPair each value with a counter.
enumerate(names, start=1)
zip(a, b)Built-insPair values from multiple iterables.
list(zip(names, scores))
python -m venv .venvEnvironmentCreate an isolated virtual environment.
python -m venv .venv
python -m pip installEnvironmentInstall a package for the selected interpreter.
python -m pip install requests