// resources
Resources
All
|
Cheatsheet
Code Example
Exercise
Template
Other
Achievement
|
Basics
Control Flow
Functions
Data Structures
Modules & Packages
Projects
Object-oriented programming
|
↑ oldest first
↓ newest first
// Code Example
parameters.py
Parameters — pass values into a function, function uses them. One function, many possible inputs. Parameter in definiti…
// Code Example
default_parameters.py
Default parameters — a fallback value when you don't pass one. Required parameters first, defaults after. Override when…
// Code Example
return_statement.py
return — send a value back to the caller. Store it, print it, pass it on. First return reached stops the function. No r…
// Code Example
scope.py
Local vs global — where variables live. Local dies with the function, global is readable everywhere. Use return to get …
// Code Example
multiple_return_values.py
Multiple return values — return a, b packs two values, x, y = function() unpacks them. Order matters. Use only what you…
// Code Example
try_except.py
try / except — handle errors gracefully. Wrap code that might fail, catch specific errors, program continues. No crash.
// Code Example
try_except_else_finally.py
try / except / else / finally — the full picture. else runs on success, finally always runs. Use only what you need.
// Code Example
raise_statement.py
raise — throw your own errors. Enforce your function's rules. as e gives access to the message. Always pair with try / …
// Code Example
list_creation.py
List creation — literals, empty lists, range sequences, and string conversion. Every way Python lets you build one.
// Code Example
split_method.py
split() — cutting strings into lists. Default whitespace split, custom separators, maxsplit, and the difference between…
// Code Example
list_indexing_slicing.py
Indexing and slicing — reaching into a list for one element or many. Positive and negative indexes, slice ranges, step,…
// Code Example
list_methods_mutating.py
Mutating list methods — append, insert, extend, remove, pop, clear, sort, reverse. Methods that change the list directl…
// Code Example
list_methods_inspection.py
Inspection methods — in, len, index, count, copy, min, max, sum. Reading a list without changing it, and the copy trap …
// Code Example
list_iteration.py
Iterating over lists — for loops, enumerate, zip, and while. Every pattern for going through a list, and when to reach …
// Code Example
list_nested.py
Nested lists — lists inside lists. Creating, accessing with double indexes, looping with nested for, modifying inner li…