You’re offline, but every Efiwe page you’ve loaded — including this one — is still available.

Python Dictionary

A beginner-friendly Python reference that clearly explains every built-in function, method, keyword, module, and Object-Oriented Programming concept — with category filters for easy lookup and links to where each feature appears in the Python learning game.

Learn Python
Function/MethodBelongs ToDescription
abs()Built-inReturns the absolute (positive) value of a number. For example, abs(-7) returns 7 and abs(3.5) returns 3.5. Useful when you only care about magnitude, not direction.
all()Built-inReturns True if every item in an iterable is truthy (or if the iterable is empty). For example, all([True, 1, 'yes']) returns True, but all([True, 0]) returns False because 0 is falsy.

Introduced in:
PythonLevel 1Challenge 50

any()Built-inReturns True if at least one item in an iterable is truthy. For example, any([False, 0, 5]) returns True because 5 is truthy.

Introduced in:
PythonLevel 1Challenge 50

ascii()Built-inReturns a string representation of an object where non-ASCII characters are escaped. For example, ascii("cafe") returns a quoted string with any accented characters replaced by their escape sequences.
bin()Built-inConverts an integer to its binary string prefixed with 0b. For example, bin(10) returns '0b1010', and bin(255) returns '0b11111111'.
bool()Built-inConverts a value to a Boolean. For example, bool(0) returns False, bool("hello") returns True, and bool([]) returns False (empty list). Almost all Python values are truthy except 0, "", [], None.

Introduced in:
PythonLevel 1Challenge 47

bytearray()Built-inCreates a mutable sequence of bytes. For example, bytearray(5) creates 5 zero bytes, and bytearray(b"hello") creates one from a bytes literal. Unlike bytes, a bytearray can be modified in place.
bytes()Built-inCreates an immutable sequence of bytes. For example, bytes(5) creates 5 zero bytes, and bytes("hello", "utf-8") encodes the string as bytes. Used for binary data, networking, and file I/O.
callable()Built-inReturns True if the object can be called like a function. For example, callable(print) returns True, and callable(42) returns False.

Introduced in:
PythonLevel 3Challenge 161

chr()Built-inReturns the string character for a given Unicode code point. For example, chr(65) returns 'A', and chr(9829) returns a heart symbol. The inverse of ord().
compile()Built-inCompiles source code (a string) into a code object that can be executed by exec() or eval(). For example, compile("1+2", "", "eval") creates a compiled expression.
complex()Built-inCreates a complex number. For example, complex(3, 4) returns (3+4j). Python uses j (not i) for the imaginary unit.
delattr()Built-inDeletes an attribute from an object. For example, delattr(obj, "name") removes the name attribute. Equivalent to del obj.name but useful when the attribute name is a variable.

Introduced in:
PythonLevel 4Challenge 192

dict()Built-inCreates a new dictionary. For example, dict(name="Alice", age=20) returns {"name": "Alice", "age": 20}.

Introduced in:
PythonLevel 2Challenge 115

dir()Built-inReturns a list of all attributes and methods of an object. For example, dir("hello") shows all string methods. Handy for exploring an unfamiliar object or module.

Introduced in:
PythonLevel 5Challenge 266

divmod()Built-inReturns a tuple of (quotient, remainder) from integer division. For example, divmod(17, 5) returns (3, 2) because 17 ÷ 5 = 3 remainder 2.

Introduced in:
PythonLevel 1Challenge 31

enumerate()Built-inWraps an iterable and yields (index, value) pairs. For example, for i, item in enumerate(["a","b","c"]) gives 0,'a', 1,'b', 2,'c'.

Introduced in:
PythonLevel 2Challenge 70

eval()Built-inEvaluates a string as a Python expression and returns the result. For example, eval("2 + 2") returns 4. Use with caution — never evaluate untrusted input.
exec()Built-inExecutes a string or compiled code object as Python statements. Unlike eval() which returns a value, exec() runs multi-line code. For example, exec("x = 5\nprint(x)") defines and prints x.
filter()Built-inFilters elements of an iterable using a function, keeping only those where the function returns True. For example, list(filter(lambda x: x > 0, [-1, 2, -3, 4])) returns [2, 4].

Introduced in:
PythonLevel 4Challenge 184

float()Built-inConverts a value to a floating-point number. For example, float("3.14") returns 3.14 and float(5) returns 5.0.

Introduced in:
PythonLevel 1Challenge 14

format()Built-inFormats a value using a format spec. For example, format(3.14159, ".2f") returns '3.14', and format(255, "x") returns 'ff' (hexadecimal).

Introduced in:
PythonLevel 1Challenge 19

frozenset()Built-inCreates an immutable set that cannot be modified. For example, frozenset([1, 2, 3]) can be used as a dictionary key, unlike a regular mutable set.

Introduced in:
PythonLevel 2Challenge 80

getattr()Built-inReturns the value of an attribute using its name as a string. For example, getattr(obj, "name") is equivalent to obj.name. You can provide a default: getattr(obj, "missing", "default") won't raise an error.

Introduced in:
PythonLevel 4Challenge 192

globals()Built-inReturns the current global symbol table as a dictionary. For example, print(globals()) shows all variables defined at module level.

Introduced in:
PythonLevel 3Challenge 176

hasattr()Built-inReturns True if an object has the given attribute. For example, hasattr(obj, "name") checks whether the attribute exists without raising an AttributeError.

Introduced in:
PythonLevel 4Challenge 192

hash()Built-inReturns the integer hash of an object, used internally by dicts and sets. Only immutable (hashable) objects like strings, numbers, and tuples can be hashed.
help()Built-inPrints built-in help documentation. For example, help(str) shows all string methods. Running help() starts an interactive help session.
hex()Built-inConverts an integer to a lowercase hex string prefixed with 0x. For example, hex(255) returns '0xff'.
id()Built-inReturns the unique memory address (as an integer) of an object. Useful for checking whether two variables reference the exact same object in memory.
input()Built-inPauses execution and reads a line of text from the user. For example, name = input("Enter your name: ") stores whatever the user types. The value is always a string.

Introduced in:
PythonLevel 1Challenge 38

int()Built-inConverts a value to an integer. For example, int("42") returns 42, and int(3.9) returns 3 (truncates toward zero).

Introduced in:
PythonLevel 1Challenge 14

isinstance()Built-inReturns True if an object is an instance of the given class or type. For example, isinstance(42, int) returns True. Safer than comparing type() directly.

Introduced in:
PythonLevel 1Challenge 13

issubclass()Built-inReturns True if a class is a subclass of another. For example, issubclass(bool, int) returns True because bool inherits from int.

Introduced in:
PythonLevel 6Challenge 347

iter()Built-inReturns an iterator object from an iterable. For example, it = iter([1, 2, 3]) creates an iterator you can step through with next().

Introduced in:
PythonLevel 6Challenge 327

len()Built-inReturns the number of items in an object. For example, len([1, 2, 3]) returns 3, and len("hello") returns 5. Works on strings, lists, tuples, dicts, sets, and more.

Introduced in:
PythonLevel 2Challenge 70

list()Built-inCreates a list from an iterable. For example, list((1, 2, 3)) converts a tuple to a list, and list("abc") gives ["a","b","c"].

Introduced in:
PythonLevel 2Challenge 70

locals()Built-inReturns a dictionary of the current local symbol table. Inside a function, print(locals()) shows all local variables.

Introduced in:
PythonLevel 3Challenge 176

map()Built-inApplies a function to every item in an iterable and returns a lazy iterator. For example, list(map(str, [1, 2, 3])) returns ["1","2","3"].

Introduced in:
PythonLevel 4Challenge 183

max()Built-inReturns the largest item. For example, max([3, 1, 4, 1, 5]) returns 5. You can pass a key function for custom comparison.

Introduced in:
PythonLevel 4Challenge 188

min()Built-inReturns the smallest item. For example, min([3, 1, 4]) returns 1.
next()Built-inReturns the next item from an iterator. For example, it = iter([10,20,30]); next(it) returns 10. Provide a default to avoid StopIteration: next(it, None).

Introduced in:
PythonLevel 6Challenge 328

object()Built-inReturns a new featureless base object. Rarely used directly, but object is the root class all Python classes inherit from.
oct()Built-inConverts an integer to its octal string prefixed with 0o. For example, oct(8) returns '0o10'.
open()Built-inOpens a file and returns a file object. For example, open("data.txt", "r") opens a file for reading. Always use with a with statement for automatic cleanup.

Introduced in:
PythonLevel 6Challenge 302

ord()Built-inReturns the Unicode code point for a single character. For example, ord("A") returns 65. The inverse of chr().
pow()Built-inReturns x raised to the power y. For example, pow(2, 10) returns 1024, and pow(2, 10, 1000) returns 24 (result modulo 1000).

Introduced in:
PythonLevel 1Challenge 30

print()Built-inOutputs text or values to the console. For example, print("Hello") displays Hello. Supports sep= (separator), end= (line ending), and file= (output target).

Introduced in:
PythonLevel 1Challenge 1

property()Built-inCreates a property descriptor, allowing getter, setter, and deleter methods. Use the @property decorator above a method to expose it as an attribute-style accessor.

Introduced in:
PythonLevel 7Challenge 361

range()Built-inGenerates a sequence of integers. For example, range(5) produces 0–4, range(1,6) produces 1–5, and range(0,10,2) counts in steps of 2.

Introduced in:
PythonLevel 2Challenge 98

repr()Built-inReturns a developer-friendly string representation of an object. For example, repr("hello\n") shows the escaped newline character. Aims to produce a string that could recreate the object.
reversed()Built-inReturns an iterator that steps through a sequence in reverse. For example, list(reversed([1,2,3])) returns [3,2,1].
round()Built-inRounds a number to a given number of decimal places. For example, round(3.14159, 2) returns 3.14. With no second argument it returns an integer.

Introduced in:
PythonLevel 1Challenge 37

set()Built-inCreates a set — an unordered collection of unique elements. For example, set([1, 2, 2, 3]) returns {1, 2, 3} (duplicates removed).

Introduced in:
PythonLevel 2Challenge 80

setattr()Built-inSets an attribute on an object using its name as a string. For example, setattr(obj, "score", 100) is equivalent to obj.score = 100.

Introduced in:
PythonLevel 4Challenge 192

slice()Built-inCreates a slice object representing a range of indices. For example, s = slice(1, 4) can be used to index a list: ["a","b","c","d","e"][s] returns ["b","c","d"].
sorted()Built-inReturns a new sorted list from any iterable. For example, sorted([3,1,4,1,5]) returns [1,1,3,4,5], and sorted(words, key=len) sorts strings by length.

Introduced in:
PythonLevel 4Challenge 188

staticmethod()Built-inMarks a method as static — it receives no implicit first argument. Use @staticmethod to define a utility function that belongs to the class namespace but needs no instance.

Introduced in:
PythonLevel 7Challenge 370

str()Built-inConverts a value to a string. For example, str(42) returns '42', and str(None) returns 'None'.

Introduced in:
PythonLevel 1Challenge 14

sum()Built-inReturns the sum of all items in an iterable. For example, sum([1,2,3,4]) returns 10, and sum([1,2,3], 10) starts from 10 giving 16.

Introduced in:
PythonLevel 1Challenge 36

super()Built-inReturns a proxy object referring to the parent class. Typically used in __init__() as super().__init__() to call the parent initializer without naming it explicitly.

Introduced in:
PythonLevel 6Challenge 352

tuple()Built-inCreates a tuple from an iterable. For example, tuple([1,2,3]) returns (1,2,3). Tuples are immutable — their values cannot be changed after creation.

Introduced in:
PythonLevel 2Challenge 76

type()Built-inReturns the type (class) of an object. For example, type(42) returns , and type("hello") returns .

Introduced in:
PythonLevel 1Challenge 13

vars()Built-inReturns the __dict__ attribute — a dictionary of an object's writable attributes. Called without arguments it behaves like locals().
zip()Built-inCombines two or more iterables element-by-element into tuples. For example, list(zip([1,2],["a","b"])) returns [(1,"a"),(2,"b")]. Stops at the shortest iterable.

Introduced in:
PythonLevel 2Challenge 96

capitalize()StringReturns a copy with the first character uppercased and the rest lowercased. For example, "hello world".capitalize() returns 'Hello world'.
casefold()StringReturns a lowercase version designed for case-insensitive comparisons. More aggressive than lower() — for example, the German character 'ss' is handled properly.
center()StringReturns the string centered in a field of given width, padded with a fill character. For example, "hi".center(10) returns ' hi '.
count()StringReturns the number of non-overlapping occurrences of a substring. For example, "banana".count("an") returns 2.

Introduced in:
PythonLevel 1Challenge 24

encode()StringEncodes the string to bytes using the given encoding (default UTF-8). For example, "hello".encode() returns b"hello". Used when working with binary files or network data.
endswith()StringReturns True if the string ends with the specified suffix. For example, "report.pdf".endswith(".pdf") returns True. Accepts a tuple of suffixes.
expandtabs()StringReplaces tab characters with spaces to align to tab stops. For example, "a\tb".expandtabs(4) returns 'a b'.
find()StringReturns the lowest index where a substring is found, or -1 if not found. For example, "hello".find("ll") returns 2. Doesn't raise an error when missing, unlike index().

Introduced in:
PythonLevel 1Challenge 24

format()StringFormats the string by replacing {} placeholders with values. For example, "Hello, {}!".format("Alice") returns 'Hello, Alice!'.

Introduced in:
PythonLevel 1Challenge 21

format_map()StringLike format() but uses a dictionary for substitutions. For example, "{name}".format_map({"name": "Alice"}) returns 'Alice'.
index()StringReturns the lowest index where a substring is found. Raises ValueError if not found. For example, "hello".index("e") returns 1. Use find() to avoid errors.
isalnum()StringReturns True if all characters are alphanumeric and the string is non-empty. For example, "abc123".isalnum() is True, but "abc 123".isalnum() is False (space is not alphanumeric).
isalpha()StringReturns True if all characters are alphabetic and the string is non-empty. For example, "hello".isalpha() is True.
isascii()StringReturns True if all characters are ASCII. For example, "hello".isascii() is True, but a string containing accented characters returns False.
isdecimal()StringReturns True if all characters are decimal digits (0–9). Stricter than isdigit() — does not accept superscripts. For example, "123".isdecimal() is True.
isdigit()StringReturns True if all characters are digit characters. Slightly broader than isdecimal() — includes some Unicode superscripts. For example, "9".isdigit() is True.
isidentifier()StringReturns True if the string is a valid Python identifier. For example, "my_var".isidentifier() is True, but "123abc".isidentifier() is False.
islower()StringReturns True if all cased characters are lowercase. For example, "hello".islower() is True, and "Hello".islower() is False.
isnumeric()StringReturns True if all characters are numeric, including Unicode numerals like fractions. Broader than isdigit().
isprintable()StringReturns True if all characters are printable (visible or space). For example, "hello\n".isprintable() is False due to the newline.
isspace()StringReturns True if the string contains only whitespace. For example, " ".isspace() is True.
istitle()StringReturns True if the string is titlecased — each word starts with a capital. For example, "Hello World".istitle() is True.
isupper()StringReturns True if all cased characters are uppercase. For example, "HELLO".isupper() is True.
join()StringJoins elements of an iterable into a single string with the string as separator. For example, ", ".join(["a","b","c"]) returns 'a, b, c'.
ljust()StringReturns the string left-justified in a field of given width. For example, "hi".ljust(10, "-") returns 'hi--------'.
lower()StringReturns the string with all characters converted to lowercase. For example, "Hello World".lower() returns 'hello world'.
lstrip()StringReturns the string with leading whitespace (or characters) removed. For example, " hello".lstrip() returns 'hello'.
maketrans()StringCreates a translation table for translate(). For example, str.maketrans("abc","xyz") maps a→x, b→y, c→z.
partition()StringSplits at the first occurrence of a separator, returning (before, sep, after). For example, "hello:world".partition(":") returns ("hello",":", "world").
replace()StringReturns a new string with all occurrences of a substring replaced. For example, "hello world".replace("world","Python") returns 'hello Python'.

Introduced in:
PythonLevel 1Challenge 24

rfind()StringLike find() but searches from the right. For example, "banana".rfind("a") returns 5 (the last 'a').
rindex()StringLike index() but searches from the right. Raises ValueError if not found.
rjust()StringReturns the string right-justified in a field of given width. For example, "hi".rjust(10,"0") returns '00000000hi'.
rpartition()StringLike partition() but splits at the last occurrence. For example, "a:b:c".rpartition(":") returns ("a:b",":","c").
rsplit()StringSplits from the right. For example, "a,b,c".rsplit(",", 1) returns ["a,b","c"] — splitting once from the right.
rstrip()StringReturns the string with trailing whitespace removed. For example, "hello ".rstrip() returns 'hello'.
split()StringSplits the string at the separator and returns a list. For example, "hello world".split() returns ["hello","world"].

Introduced in:
PythonLevel 1Challenge 24

splitlines()StringSplits at line boundaries. For example, "line1\nline2".splitlines() returns ["line1","line2"].
startswith()StringReturns True if the string starts with the prefix. For example, "https://efiwe.com".startswith("https") returns True.
strip()StringReturns the string with leading and trailing whitespace removed. For example, " hello ".strip() returns 'hello'.
swapcase()StringSwaps uppercase to lowercase and vice versa. For example, "Hello World".swapcase() returns 'hELLO wORLD'.
title()StringReturns a titlecased string where each word starts with uppercase. For example, "hello world".title() returns 'Hello World'.
translate()StringTranslates characters using a table created by maketrans(). For example, using a table that maps 'a' to 'x', "banana".translate(table) replaces all 'a' characters.
upper()StringReturns the string with all characters converted to uppercase. For example, "hello".upper() returns 'HELLO'.
zfill()StringPads the string on the left with zeros to reach the given width. For example, "42".zfill(5) returns '00042'.
append()ListAdds a single element to the end of the list. For example, nums = [1,2]; nums.append(3) makes nums become [1,2,3].

Introduced in:
PythonLevel 2Challenge 72

clear()ListRemoves all elements from the list. For example, my_list.clear() results in []. The list object still exists.
copy()ListReturns a shallow copy. For example, new = original.copy() creates a new list so modifying new doesn't affect original.
count()ListReturns the number of times a value appears. For example, [1,2,2,3,2].count(2) returns 3.
extend()ListAdds all elements of an iterable to the end. For example, [1,2].extend([3,4]) gives [1,2,3,4]. Unlike append(), it unpacks the iterable.

Introduced in:
PythonLevel 2Challenge 72

index()ListReturns the index of the first occurrence of a value. For example, [10,20,30].index(20) returns 1. Raises ValueError if not present.
insert()ListInserts an element at a specified position. For example, nums = [1,3]; nums.insert(1, 2) gives [1,2,3].

Introduced in:
PythonLevel 2Challenge 72

pop()ListRemoves and returns the element at a given index (default: last). For example, nums = [1,2,3]; nums.pop() returns 3 and leaves [1,2].

Introduced in:
PythonLevel 2Challenge 72

remove()ListRemoves the first occurrence of a value. For example, [1,2,2,3].remove(2) gives [1,2,3]. Raises ValueError if not found.

Introduced in:
PythonLevel 2Challenge 72

reverse()ListReverses the list in place. For example, nums = [1,2,3]; nums.reverse() makes nums become [3,2,1].
sort()ListSorts the list in place. For example, [3,1,4].sort() gives [1,3,4]. Use sort(reverse=True) for descending and sort(key=len) for a custom key.

Introduced in:
PythonLevel 2Challenge 75

clear()DictionaryRemoves all items from the dictionary. For example, d = {"a":1}; d.clear() makes d become {}.

Introduced in:
PythonLevel 2Challenge 118

copy()DictionaryReturns a shallow copy. For example, new_d = d.copy() creates a new dict, so modifying new_d doesn't affect d.
fromkeys()DictionaryCreates a dict from a sequence of keys, all set to the same value. For example, dict.fromkeys(["a","b","c"], 0) returns {"a":0,"b":0,"c":0}.
get()DictionaryReturns the value for a key, or a default if the key is missing. For example, d.get("score", 0) returns the score or 0 — avoiding a KeyError.

Introduced in:
PythonLevel 3Challenge 125

items()DictionaryReturns a view of all key-value pairs as tuples. For example, for k, v in d.items() lets you loop over both key and value at once.

Introduced in:
PythonLevel 2Challenge 107

keys()DictionaryReturns a view of all keys. For example, list(d.keys()) gives all keys as a list.

Introduced in:
PythonLevel 2Challenge 105

pop()DictionaryRemoves and returns the value for the specified key. For example, d.pop("age") removes and returns the age. Provide a default to avoid KeyError: d.pop("age", None).

Introduced in:
PythonLevel 2Challenge 118

popitem()DictionaryRemoves and returns the last inserted key-value pair as a tuple. In Python 3.7+, dicts maintain insertion order, so this is deterministic.

Introduced in:
PythonLevel 2Challenge 118

setdefault()DictionaryReturns the value for a key if it exists; otherwise inserts it with the given default. For example, d.setdefault("score", 0) sets score to 0 only if not already present.
update()DictionaryUpdates the dictionary with pairs from another dict. For example, d.update({"age": 21}) adds or overwrites the age key.

Introduced in:
PythonLevel 2Challenge 117

values()DictionaryReturns a view of all values. For example, list(d.values()) gives all values as a list. The view reflects live changes.

Introduced in:
PythonLevel 2Challenge 106

count()TupleReturns the number of times a value appears in the tuple. For example, (1,2,2,3).count(2) returns 2.
index()TupleReturns the index of the first occurrence of a value. For example, ("a","b","c").index("b") returns 1. Raises ValueError if not found.
add()SetAdds an element to the set. For example, s = {1,2}; s.add(3) makes s become {1,2,3}.

Introduced in:
PythonLevel 2Challenge 82

clear()SetRemoves all elements from the set. For example, s.clear() results in set().
copy()SetReturns a shallow copy of the set.
difference()SetReturns elements in this set but not in others. For example, {1,2,3}.difference({2,3,4}) returns {1}. Also: {1,2,3} - {2,3,4}.
difference_update()SetRemoves all elements found in other sets from this set. For example, s.difference_update({2,3}) is like s -= {2,3}.
discard()SetRemoves an element if present — does not raise an error if missing. For example, s.discard(99) silently does nothing if 99 isn't there.
intersection()SetReturns elements common to all given sets. For example, {1,2,3}.intersection({2,3,4}) returns {2,3}. Also: {1,2,3} & {2,3,4}.
intersection_update()SetKeeps only elements also in other sets. For example, s.intersection_update({2,3}) is like s &= {2,3}.
isdisjoint()SetReturns True if the two sets have no common elements. For example, {1,2}.isdisjoint({3,4}) is True.
issubset()SetReturns True if all elements of this set are in another. For example, {1,2}.issubset({1,2,3}) is True. Also: {1,2} <= {1,2,3}.
issuperset()SetReturns True if all elements of another set are in this set. For example, {1,2,3}.issuperset({1,2}) is True. Also: {1,2,3} >= {1,2}.
pop()SetRemoves and returns an arbitrary element. Since sets are unordered, you can't control which one is removed.
remove()SetRemoves a specific element. Raises KeyError if not found — use discard() to avoid that.

Introduced in:
PythonLevel 2Challenge 82

symmetric_difference()SetReturns elements in either set but not both. For example, {1,2,3}.symmetric_difference({2,3,4}) returns {1,4}. Also: {1,2,3} ^ {2,3,4}.
symmetric_difference_update()SetUpdates the set to keep only elements not in both. For example, s.symmetric_difference_update({2,3}) is like s ^= {2,3}.
union()SetReturns all elements from this set and others. For example, {1,2}.union({2,3,4}) returns {1,2,3,4}. Also: {1,2} | {3,4}.
update()SetAdds all elements from an iterable to the set. For example, s.update([4,5]) adds 4 and 5 to s.
close()FileCloses the file and releases resources. Best practice is to use with open() as f which closes automatically.

Introduced in:
PythonLevel 6Challenge 303

detach()FileSeparates the raw binary stream from the text wrapper and returns it. After calling this, the file object becomes unusable.
fileno()FileReturns the integer file descriptor used by the OS. Rarely needed in normal code; used for passing to OS-level calls.
flush()FileForces any buffered data to be written to the file immediately without closing it. Useful for real-time log output.
isatty()FileReturns True if the file stream is connected to a terminal.
read()FileReads and returns the entire file content (or up to n bytes). For example, content = f.read() stores the whole file as a string.

Introduced in:
PythonLevel 6Challenge 304

readable()FileReturns True if the file can be read. Files opened in write-only mode return False.
readline()FileReads one line from the file (up to and including the newline). Calling it repeatedly steps through the file line by line.

Introduced in:
PythonLevel 6Challenge 305

readlines()FileReads all lines and returns them as a list of strings. Consider for line in f for memory-efficient reading.

Introduced in:
PythonLevel 6Challenge 305

seek()FileMoves the read/write position to a given byte offset. For example, f.seek(0) rewinds to the start of the file.
seekable()FileReturns True if the file supports seek() and tell(). Network streams are typically not seekable.
tell()FileReturns the current file position as a byte offset from the start.
truncate()FileResizes the file to the specified size in bytes. Any data beyond the new size is deleted.
writable()FileReturns True if the file can be written to. Files in read-only mode return False.
write()FileWrites a string to the file and returns the number of characters written. The file must be opened in write or append mode.

Introduced in:
PythonLevel 6Challenge 307

writelines()FileWrites a list of strings to the file. No newlines are added automatically — include \n in each string if needed.
andKeywordA logical operator that returns True only if both conditions are true. For example, x > 0 and x < 10 is true only when x is between 1 and 9. Short-circuits: if the left side is false, the right is not evaluated.

Introduced in:
PythonLevel 1Challenge 50

asKeywordCreates an alias. For example, import numpy as np lets you use np, and with open('f.txt') as f names the file object f.

Introduced in:
PythonLevel 5Challenge 267

assertKeywordTests a condition and raises AssertionError if false. For example, assert age >= 0, "Age cannot be negative" validates input. Assertions can be disabled with -O.

Introduced in:
PythonLevel 5Challenge 258

asyncKeywordDefines an asynchronous function (a coroutine). For example, async def fetch_data(): creates a function that can pause while waiting for I/O, allowing other code to run.
awaitKeywordPauses execution inside an async function until the awaited coroutine completes. For example, result = await some_coroutine() yields control back to the event loop while waiting.
breakKeywordImmediately exits the nearest enclosing loop. For example, if score == 100: break stops iteration as soon as a perfect score is found.

Introduced in:
PythonLevel 3Challenge 144

caseKeywordDefines a pattern branch in a match statement. For example, case "admin": handles the value 'admin', and case _: is the default fallback.

Introduced in:
PythonLevel 2Challenge 62

classKeywordDefines a new class. For example, class Learner: starts a class definition. Everything indented below belongs to the class.

Introduced in:
PythonLevel 4Challenge 192

continueKeywordSkips the rest of the current loop iteration and moves to the next one. For example, if score < 0: continue skips invalid values without breaking the loop.

Introduced in:
PythonLevel 3Challenge 146

defKeywordDefines a new function. For example, def greet(name): creates a function. Everything indented below is the function body.

Introduced in:
PythonLevel 3Challenge 162

delKeywordDeletes a variable, list item, or attribute. For example, del my_list[2] removes item at index 2, and del my_var removes a variable entirely.

Introduced in:
PythonLevel 2Challenge 118

elifKeywordAdds an additional condition to an if statement (short for 'else if'). For example, elif score >= 70: print('Pass') is checked only if the preceding if was false.

Introduced in:
PythonLevel 1Challenge 57

elseKeywordRuns when all preceding if/elif conditions are false. Also used with loops (runs when no break occurred) and with try (runs when no exception occurred).

Introduced in:
PythonLevel 1Challenge 55

exceptKeywordCatches an exception raised inside a try block. For example, except ValueError as e: catches a ValueError. Multiple except blocks can handle different types.

Introduced in:
PythonLevel 5Challenge 247

FalseKeywordThe boolean literal for false. For example, is_active = False. False equals 0 numerically in Python.

Introduced in:
PythonLevel 1Challenge 47

finallyKeywordRuns a block whether or not an exception occurred in try. For example, finally: f.close() ensures the file is always closed.

Introduced in:
PythonLevel 5Challenge 254

forKeywordCreates a loop that iterates over each item in an iterable. For example, for item in my_list: runs the body once per element.
fromKeywordImports specific names from a module. For example, from math import sqrt imports only sqrt so you can call it without the math. prefix.

Introduced in:
PythonLevel 5Challenge 267

globalKeywordDeclares that a variable inside a function refers to the module-level global. For example, global counter lets a function modify the outer counter variable.

Introduced in:
PythonLevel 3Challenge 176

ifKeywordExecutes a block only when a condition is true. For example, if score >= 50: print('Pass') prints only when the threshold is met.

Introduced in:
PythonLevel 1Challenge 53

importKeywordLoads a module into the current namespace. For example, import math gives access to math.sqrt() and other math functions.

Introduced in:
PythonLevel 5Challenge 267

inKeywordTests membership in a sequence. For example, "python" in skills returns True if the string is in the list. Also used in for loops.

Introduced in:
PythonLevel 2Challenge 82

isKeywordTests object identity — whether two variables point to the exact same object. For example, x is None is the recommended way to check for None.

Introduced in:
PythonLevel 1Challenge 18

lambdaKeywordCreates an anonymous function in a single expression. For example, square = lambda x: x ** 2 creates a function that squares its input.

Introduced in:
PythonLevel 4Challenge 181

matchKeywordStarts structural pattern-matching (Python 3.10+). For example, match command: case "quit": ... compares against each case.

Introduced in:
PythonLevel 2Challenge 62

NoneKeywordRepresents the absence of a value. A function with no return returns None by default. Use is None to check for it.

Introduced in:
PythonLevel 1Challenge 17

nonlocalKeywordDeclares that a variable in a nested function refers to the enclosing function's scope. For example, nonlocal count lets an inner function modify count in the outer function.

Introduced in:
PythonLevel 3Challenge 176

notKeywordLogical NOT — inverts a boolean. For example, not True is False.

Introduced in:
PythonLevel 1Challenge 50

orKeywordReturns True if at least one condition is true. For example, x < 0 or x > 100 catches out-of-range values.

Introduced in:
PythonLevel 1Challenge 50

passKeywordA no-op placeholder that does nothing. Used when a code block is required but you have nothing to put there yet.

Introduced in:
PythonLevel 3Challenge 162

raiseKeywordRaises an exception manually. For example, raise ValueError("Score must be positive") signals an error from your own code.

Introduced in:
PythonLevel 5Challenge 257

returnKeywordExits a function and optionally sends back a value. A bare return or no return statement returns None.

Introduced in:
PythonLevel 3Challenge 167

TrueKeywordThe boolean literal for true. True equals 1 numerically in Python.

Introduced in:
PythonLevel 1Challenge 47

tryKeywordStarts a block where exceptions are caught. Code inside is monitored; any exception triggers the matching except handler instead of crashing.

Introduced in:
PythonLevel 5Challenge 247

whileKeywordCreates a loop that repeats as long as a condition is true. Always ensure the condition eventually becomes false to avoid infinite loops.

Introduced in:
PythonLevel 3Challenge 140

withKeywordManages a resource using a context manager, ensuring cleanup happens automatically. For example, with open("data.txt") as f: guarantees the file is closed.

Introduced in:
PythonLevel 6Challenge 303

yieldKeywordPauses a generator function and returns a value to the caller without losing state. The function resumes on the next next() call.

Introduced in:
PythonLevel 6Challenge 337

ArithmeticErrorExceptionBase class for numeric calculation errors including ZeroDivisionError and OverflowError.
AssertionErrorExceptionRaised when an assert statement fails. For example, assert 1 == 2 raises AssertionError.
AttributeErrorExceptionRaised when you access or set an attribute that doesn't exist. For example, "hello".nonexistent raises AttributeError.
EOFErrorExceptionRaised when input() hits end-of-file with no data to read.
FloatingPointErrorExceptionRaised when a floating-point operation fails. Rarely seen — most floating-point errors produce inf or nan instead.
GeneratorExitExceptionRaised inside a generator when .close() is called on it, signalling the generator to stop.
ImportErrorExceptionRaised when an import cannot find or load a module. For example, import nonexistent_module raises this.
IndentationErrorExceptionRaised when indentation is incorrect. For example, mixing tabs and spaces in the same block causes this.
IndexErrorExceptionRaised when a sequence index is out of range. For example, [1,2,3][10] raises IndexError: list index out of range.

Introduced in:
PythonLevel 5Challenge 251

KeyErrorExceptionRaised when a dictionary key doesn't exist. For example, d = {"a":1}; d["b"] raises KeyError: "b". Use .get() to avoid it.

Introduced in:
PythonLevel 3Challenge 125

KeyboardInterruptExceptionRaised when the user presses Ctrl+C to stop a running program.
LookupErrorExceptionBase class for IndexError and KeyError — raised when a lookup by key or index fails.
MemoryErrorExceptionRaised when a program runs out of memory.
NameErrorExceptionRaised when a variable is used before being defined. For example, print(undefined_var) raises NameError.
NotImplementedErrorExceptionRaised in abstract base classes to signal that a subclass must override a method.
OSErrorExceptionRaised when an OS-related operation fails — file not found, permission denied, etc.
OverflowErrorExceptionRaised when a numeric result is too large for the type to represent.
RecursionErrorExceptionRaised when the maximum recursion depth is exceeded. A function calling itself without a base case will trigger this.
RuntimeErrorExceptionA catch-all for unexpected runtime problems that don't fit another category.
StopIterationExceptionRaised by next() when an iterator has no more items. Used internally by for loops.

Introduced in:
PythonLevel 6Challenge 329

SyntaxErrorExceptionRaised when Python's parser encounters invalid syntax. Occurs before the program runs.
TabErrorExceptionRaised when indentation mixes tabs and spaces inconsistently (a subclass of IndentationError).
TypeErrorExceptionRaised when an operation is applied to the wrong type. For example, "hello" + 5 raises TypeError.
UnboundLocalErrorExceptionRaised when a local variable is referenced before being assigned inside a function.
ValueErrorExceptionRaised when a function receives the right type but a value that makes no sense. For example, int("abc") raises ValueError.

Introduced in:
PythonLevel 5Challenge 249

ZeroDivisionErrorExceptionRaised when dividing by zero. For example, 10 / 0 raises ZeroDivisionError: division by zero.

Introduced in:
PythonLevel 5Challenge 248

math.acos()ModuleReturns the arc cosine of a number in radians. Input must be in [-1, 1]. For example, math.acos(1) returns 0.0.
math.asin()ModuleReturns the arc sine of a number in radians. For example, math.asin(0) returns 0.0.
math.atan()ModuleReturns the arc tangent of a number in radians. For example, math.atan(1) returns approximately 0.785 (π/4).
math.atan2()ModuleReturns the arc tangent of y/x across all four quadrants. For example, math.atan2(1, 1) returns π/4.
math.ceil()ModuleRounds a number up to the nearest integer. For example, math.ceil(3.1) returns 4.
math.cos()ModuleReturns the cosine of an angle in radians. For example, math.cos(0) returns 1.0.
math.degrees()ModuleConverts radians to degrees. For example, math.degrees(math.pi) returns 180.0.
math.exp()ModuleReturns e raised to the given power. For example, math.exp(1) returns approximately 2.718.
math.fabs()ModuleReturns the absolute value as a float. For example, math.fabs(-5) returns 5.0.
math.factorial()ModuleReturns the factorial of an integer. For example, math.factorial(5) returns 120 (5 × 4 × 3 × 2 × 1).
math.floor()ModuleRounds a number down to the nearest integer. For example, math.floor(3.9) returns 3.
math.gcd()ModuleReturns the greatest common divisor of two integers. For example, math.gcd(12, 8) returns 4.
math.hypot()ModuleReturns the Euclidean distance. For example, math.hypot(3, 4) returns 5.0 — the hypotenuse of a 3-4-5 triangle.
math.log()ModuleReturns the natural logarithm (or log to any base). For example, math.log(math.e) returns 1.0, and math.log(100, 10) returns 2.0.
math.log10()ModuleReturns the base-10 logarithm. For example, math.log10(1000) returns 3.0.
math.log2()ModuleReturns the base-2 logarithm. For example, math.log2(8) returns 3.0.
math.pow()ModuleReturns x raised to y as a float. For example, math.pow(2, 10) returns 1024.0.

Introduced in:
PythonLevel 5Challenge 268

math.radians()ModuleConverts degrees to radians. For example, math.radians(180) returns approximately 3.14159 (π).
math.sin()ModuleReturns the sine of an angle in radians. For example, math.sin(math.pi / 2) returns 1.0.
math.sqrt()ModuleReturns the square root. For example, math.sqrt(16) returns 4.0.

Introduced in:
PythonLevel 5Challenge 270

math.tan()ModuleReturns the tangent of an angle in radians. For example, math.tan(math.pi / 4) returns approximately 1.0.
math.trunc()ModuleTruncates a float toward zero. For example, math.trunc(3.9) returns 3 and math.trunc(-3.9) returns -3.
math.eModuleThe mathematical constant e ≈ 2.71828 — the base of natural logarithms.
math.piModuleThe mathematical constant π ≈ 3.14159 — the ratio of a circle's circumference to its diameter.
math.tauModuleEqual to 2π (≈ 6.28318). math.tau is the ratio of a circle's circumference to its radius.
math.infModuleFloating-point positive infinity. For example, math.inf > 10**100 is True. Use -math.inf for negative infinity.
random.seed()ModuleInitializes the random number generator. For example, random.seed(42) makes all subsequent random calls produce the same sequence — useful for reproducible tests.

Introduced in:
PythonLevel 5Challenge 271

random.random()ModuleReturns a random float in [0.0, 1.0).

Introduced in:
PythonLevel 5Challenge 271

random.randint()ModuleReturns a random integer between a and b inclusive. For example, random.randint(1, 6) simulates a dice roll.

Introduced in:
PythonLevel 5Challenge 271

random.randrange()ModuleReturns a randomly selected element from a range. For example, random.randrange(0,10,2) returns a random even number 0–8.
random.choice()ModuleReturns a random element from a non-empty sequence. For example, random.choice(["rock","paper","scissors"]).

Introduced in:
PythonLevel 5Challenge 272

random.choices()ModuleReturns a list of k elements chosen with replacement. For example, random.choices([1,2,3], k=5) picks 5 items (repeats allowed).
random.shuffle()ModuleShuffles a list in place. For example, random.shuffle(my_list) randomizes the order of elements.
random.sample()ModuleReturns k unique elements from a population. For example, random.sample(range(50), 6) picks 6 unique lottery numbers.
datetime.date()ModuleCreates a date object with year, month, and day. For example, datetime.date(2025, 6, 1) represents June 1, 2025.

Introduced in:
PythonLevel 5Challenge 275

datetime.datetime()ModuleCreates a datetime combining date and time. For example, datetime.datetime(2025, 6, 1, 12, 0) represents noon on June 1, 2025.

Introduced in:
PythonLevel 5Challenge 276

datetime.now()ModuleReturns the current local date and time.

Introduced in:
PythonLevel 5Challenge 275

datetime.strftime()ModuleFormats a datetime as a string. For example, dt.strftime("%Y-%m-%d") returns '2025-06-01'.

Introduced in:
PythonLevel 5Challenge 277

datetime.strptime()ModuleParses a date string into a datetime object. For example, datetime.datetime.strptime("2025-06-01", "%Y-%m-%d").
datetime.timedelta()ModuleRepresents a duration. For example, timedelta(days=7) is one week, and datetime.now() + timedelta(days=30) gives a date 30 days from now.

Introduced in:
PythonLevel 5Challenge 278

statistics.mean()ModuleCalculates the arithmetic mean. For example, statistics.mean([1,2,3,4,5]) returns 3.

Introduced in:
PythonLevel 5Challenge 279

statistics.median()ModuleReturns the middle value. For example, statistics.median([1,3,5]) returns 3.

Introduced in:
PythonLevel 5Challenge 280

statistics.mode()ModuleReturns the most common value. For example, statistics.mode([1,2,2,3]) returns 2.

Introduced in:
PythonLevel 5Challenge 280

statistics.stdev()ModuleCalculates the standard deviation from a sample of data.

Introduced in:
PythonLevel 5Challenge 281

statistics.variance()ModuleReturns the sample variance — average squared deviation from the mean.

Introduced in:
PythonLevel 5Challenge 281

re.search()ModuleScans through a string and returns the first match, or None. For example, re.search(r"\d+", "score: 42") finds 42.

Introduced in:
PythonLevel 7Challenge 401

re.match()ModuleTests if the pattern matches at the start of the string. For example, re.match(r"hello", "hello world") returns a match.
re.findall()ModuleReturns a list of all non-overlapping matches. For example, re.findall(r"\d+", "a1 b22 c333") returns ["1","22","333"].

Introduced in:
PythonLevel 7Challenge 402

re.sub()ModuleReplaces all occurrences of a pattern. For example, re.sub(r"\s+", " ", text) collapses multiple spaces into one.

Introduced in:
PythonLevel 7Challenge 407

re.compile()ModuleCompiles a regex pattern into a reusable object for faster repeated use.

Introduced in:
PythonLevel 7Challenge 400

re.split()ModuleSplits a string by pattern occurrences. For example, re.split(r"[,;]+", "a,b;;c") returns ["a","b","c"].
re.fullmatch()ModuleReturns a match only if the entire string matches. For example, re.fullmatch(r"\d{4}", "2025") matches but re.fullmatch(r"\d{4}", "2025x") does not.
os.path.join()ModuleJoins path components with the OS separator. For example, os.path.join("home","user","file.txt") returns the right path for your OS.

Introduced in:
PythonLevel 5Challenge 290

os.listdir()ModuleReturns a list of files and folders in a directory. For example, os.listdir(".") lists everything in the current directory.

Introduced in:
PythonLevel 7Challenge 417

os.path.exists()ModuleReturns True if the path exists. For example, os.path.exists("data.txt") checks before opening.

Introduced in:
PythonLevel 7Challenge 418

os.getcwd()ModuleReturns the current working directory as a string.
os.environModuleA dict-like object of environment variables. For example, os.environ.get("PATH") reads the system PATH.
json.dumps()ModuleConverts a Python object to a JSON string. For example, json.dumps({"name":"Alice","score":95}) returns a formatted JSON string.

Introduced in:
PythonLevel 6Challenge 313

json.loads()ModuleParses a JSON string and returns a Python object. For example, json.loads('{"name":"Alice"}') returns a dictionary.

Introduced in:
PythonLevel 6Challenge 314

json.dump()ModuleWrites a Python object as JSON to a file. For example, json.dump(data, f, indent=2) writes nicely formatted JSON.

Introduced in:
PythonLevel 6Challenge 315

json.load()ModuleReads JSON from a file and returns the Python object.

Introduced in:
PythonLevel 6Challenge 316

collections.Counter()ModuleCreates a counting dictionary. For example, Counter(["a","b","a"]) returns Counter({'a': 2, 'b': 1}).

Introduced in:
PythonLevel 5Challenge 282

collections.defaultdict()ModuleLike a regular dict but auto-creates defaults for missing keys. For example, defaultdict(list) creates an empty list for any new key.

Introduced in:
PythonLevel 5Challenge 284

collections.deque()ModuleA double-ended queue with O(1) appends/pops from both ends. Supports .appendleft() and .popleft().

Introduced in:
PythonLevel 5Challenge 285

collections.namedtuple()ModuleCreates a tuple subclass with named fields. For example, Point = namedtuple("Point", ["x","y"]); p = Point(1,2); p.x returns 1.

Introduced in:
PythonLevel 5Challenge 286

functools.reduce()ModuleApplies a function cumulatively to reduce an iterable to one value. For example, reduce(lambda a,b: a+b, [1,2,3,4]) returns 10.

Introduced in:
PythonLevel 4Challenge 185

__init__()Object-Oriented ProgrammingThe initializer method called when a new object is created. For example, def __init__(self, name): self.name = name sets the name attribute for every new instance.

Introduced in:
PythonLevel 4Challenge 195

__str__()Object-Oriented ProgrammingDefines the human-readable string representation returned by str(obj) and print(obj). For example, def __str__(self): return f"Learner: {self.name}".
__repr__()Object-Oriented ProgrammingDefines the developer-facing representation used by the REPL and repr(). Convention: return a string that looks like the constructor call.
__len__()Object-Oriented ProgrammingAllows len() to work on your object. For example, def __len__(self): return len(self.items) makes len(my_obj) work.
__eq__()Object-Oriented ProgrammingDefines equality comparison with ==. For example, def __eq__(self, other): return self.score == other.score makes objects equal when their scores match.
__lt__()Object-Oriented ProgrammingDefines less-than comparison with <. Implement this along with __eq__ to enable sorted() on your objects.
__getitem__()Object-Oriented ProgrammingAllows subscript access with obj[key]. For example, def __getitem__(self, key): return self.data[key].
__iter__()Object-Oriented ProgrammingMakes an object iterable. For example, def __iter__(self): return iter(self.items) lets you use the object in a for loop.

Introduced in:
PythonLevel 6Challenge 331

__next__()Object-Oriented ProgrammingReturns the next value in a custom iterator. Raises StopIteration when exhausted.

Introduced in:
PythonLevel 6Challenge 332

@classmethodObject-Oriented ProgrammingMarks a method as a class method — receives the class (cls) as the first argument. For example, @classmethod def create(cls): return cls() is a factory method.

Introduced in:
PythonLevel 7Challenge 369

@staticmethodObject-Oriented ProgrammingMarks a method as static — receives neither self nor cls. Useful for utility functions that belong to the class namespace but need no instance.

Introduced in:
PythonLevel 7Challenge 370

@propertyObject-Oriented ProgrammingTurns a method into a read-only attribute accessor. For example, @property def full_name(self): return f"{self.first} {self.last}" lets you access it as obj.full_name.

Introduced in:
PythonLevel 7Challenge 361

@property.setterObject-Oriented ProgrammingDefines the setter for a @property. For example, @score.setter def score(self, v): self._score = max(0, v) validates on assignment.

Introduced in:
PythonLevel 7Challenge 362

super()Object-Oriented ProgrammingReturns a proxy referring to the parent class. Used in __init__() as super().__init__(name) to call the parent initializer.

Introduced in:
PythonLevel 6Challenge 352

selfObject-Oriented ProgrammingThe conventional first parameter of instance methods, referring to the object the method was called on. Python passes it automatically.

Introduced in:
PythonLevel 4Challenge 196

inheritanceObject-Oriented ProgrammingA child class inheriting attributes and methods from a parent. For example, class PremiumLearner(Learner): gets everything Learner has, plus whatever it adds.

Introduced in:
PythonLevel 6Challenge 347

encapsulationObject-Oriented ProgrammingBundling data and behaviour inside a class and controlling access. Prefix with _ to signal internal use, or __ for name mangling.

Introduced in:
PythonLevel 6Challenge 355

polymorphismObject-Oriented ProgrammingDifferent classes implementing the same method name in their own way. For example, both Dog and Cat can have a speak() method returning different sounds.

Introduced in:
PythonLevel 7Challenge 365

indentationGlossaryPython uses indentation (spaces at the beginning of a line) to define code blocks — there are no curly braces. The standard is 4 spaces per level. Inconsistent indentation raises IndentationError.

Introduced in:
PythonLevel 1Challenge 54

variableGlossaryA named container for storing data. For example, name = 'Alice' creates a variable called name holding the string 'Alice'. Python infers the type automatically.

Introduced in:
PythonLevel 1Challenge 9

commentGlossaryA note in code that Python ignores when running. A single-line comment starts with #. For example, # This prints the name. Comments explain the intent of the code.

Introduced in:
PythonLevel 1Challenge 4

f-stringGlossaryA string literal prefixed with f that allows expressions inside {}. For example, f"Hello, {name}!" inserts the value of name directly into the string.

Introduced in:
PythonLevel 1Challenge 19

slicingGlossaryExtracting a portion of a sequence using [start:stop:step]. For example, "hello"[1:4] returns 'ell', and [1,2,3,4][::2] returns [1,3].
list comprehensionGlossaryA concise way to build a list using a for expression inside []. For example, [x**2 for x in range(5)] returns [0,1,4,9,16].

Introduced in:
PythonLevel 4Challenge 222

dict comprehensionGlossaryA concise way to build a dictionary. For example, {k: v**2 for k, v in items} creates a new dict with squared values.

Introduced in:
PythonLevel 4Challenge 229

set comprehensionGlossaryA concise way to build a set. For example, {x.lower() for x in words} creates a set of lowercased words with no duplicates.

Introduced in:
PythonLevel 4Challenge 233

generator expressionGlossaryLike a list comprehension but uses () and evaluates lazily. For example, sum(x**2 for x in range(100)) computes without building the whole list in memory.

Introduced in:
PythonLevel 6Challenge 341

unpackingGlossaryAssigning sequence elements to multiple variables in one line. For example, a, b, c = [1, 2, 3] assigns each item. Use *rest to catch extra items.

Introduced in:
PythonLevel 4Challenge 235

*argsGlossaryAllows a function to accept any number of positional arguments. For example, def total(*args): return sum(args) lets you call total(1,2,3) or total(1,2,3,4,5).

Introduced in:
PythonLevel 3Challenge 173

**kwargsGlossaryAllows a function to accept any number of keyword arguments as a dictionary. For example, def profile(**kwargs): print(kwargs) collects all named arguments.

Introduced in:
PythonLevel 3Challenge 174

decoratorGlossaryA function that wraps another function to add behaviour. Applied with @decorator_name above the function definition. For example, @staticmethod and @property are built-in decorators.

Introduced in:
PythonLevel 7Challenge 391

walrus operator :=GlossaryAssigns a value and returns it in the same expression. For example, if n := len(data); n > 10: both stores and tests the length. Introduced in Python 3.8.

Introduced in:
PythonLevel 7Challenge 396

iteratorGlossaryAn object that implements __iter__() and __next__(), letting you step through values one at a time. All Python for loops use iterators internally.

Introduced in:
PythonLevel 6Challenge 326

generatorGlossaryA function that uses yield to produce values lazily, one at a time. Unlike a list, it doesn't build all values in memory at once. For example, def count_up(n): for i in range(n): yield i.

Introduced in:
PythonLevel 6Challenge 336

global scopeGlossaryVariables defined at module level (outside any function or class) are in the global scope — accessible from anywhere in the file.

Introduced in:
PythonLevel 3Challenge 176

local scopeGlossaryVariables defined inside a function exist only while that function runs. They are destroyed when the function returns.

Introduced in:
PythonLevel 3Challenge 176

moduleGlossaryA file containing Python code that can be imported. For example, import math loads the built-in math module, giving access to functions like math.sqrt().

Introduced in:
PythonLevel 5Challenge 266

packageGlossaryA folder containing multiple modules and an __init__.py file. For example, import os.path uses the os package.
pipGlossaryPython's package manager. For example, pip install requests downloads and installs the requests library from PyPI.

Introduced in:
PythonLevel 5Challenge 293

virtual environmentGlossaryAn isolated Python environment where you install packages without affecting other projects. Created with python -m venv myenv.

Introduced in:
PythonLevel 5Challenge 294