// resources

Resources

// Code Example
def_function.py
def — define a function once, call it anywhere. Parentheses required, indentation mandatory, defining doesn't run it — …
19 downloads 04 May 2026 → Your first function
[ download ]
// Code Example
parameters.py
Parameters — pass values into a function, function uses them. One function, many possible inputs. Parameter in definiti…
[ download ]
// Code Example
default_parameters.py
Default parameters — a fallback value when you don't pass one. Required parameters first, defaults after. Override when…
18 downloads 05 May 2026 → A value if you don't provide one
[ download ]
// 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…
18 downloads 05 May 2026 → Your function finally talks back
[ download ]
// Code Example
scope.py
Local vs global — where variables live. Local dies with the function, global is readable everywhere. Use return to get …
[ download ]
// 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…
18 downloads 05 May 2026 → Return two things at once
[ download ]
// Code Example
try_except.py
try / except — handle errors gracefully. Wrap code that might fail, catch specific errors, program continues. No crash.
18 downloads 05 May 2026 → Don't let errors crash your program
[ download ]
// 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.
[ download ]
// 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 / …
18 downloads 05 May 2026 → Throw your own errors
[ download ]