// blog

Articles

// Functions
Return two things at once

The problem...
Your function calculates two things. But return sends back one value and stops.
You'd need two functions. Or you'd print one and return the other. Neither feels c…

05 May 2026 1 min read files [1] comments [0] 20 views
// Functions
Don't let errors crash your program

The problem...
Your program asks for a number. The user types a word. Python crashes.
age = int(input("Enter your age: ")) # user types "abc"
# ValueError: invalid literal f…

05 May 2026 1 min read files [1] comments [0] 20 views
// Functions
There's more to error handling than catching

The problem...
You know try / except. You catch the error. You handle it. Done.
But sometimes you need more. Code that runs only when everything worked. Code that runs no matter…

05 May 2026 2 min read files [1] comments [0] 20 views
// Functions
Throw your own errors

The problem...
Python raises errors when something goes wrong — wrong type, wrong value, division by zero.
But sometimes you need to raise an error yourself. The input is …

05 May 2026 1 min read files [1] comments [0] 20 views
// Functions
ErrorHandling Mini Project — BMI Calculator

The problem...
You've built the BMI Calculator three times. Each version was better than the last.
But none of them handled bad input. Type a word — crash. Enter a negativ…

05 May 2026 1 min read files [1] comments [0] 20 views
// Functions
Common Functions Mistakes

The problem...
Your function doesn't return what you expect. Or it crashes on valid input. Or it changes a variable that shouldn't change.
These are the mistakes almost every be…

05 May 2026 2 min read files [1] comments [0] 21 views