π Functions Explained Like You're 5
Building AI systems and writing about how they actually work. Master of AI @ University of Technology Sydney. Previously B.Tech CS with focus on IoT. I believe the best way to learn is to explain. That's why I'm documenting tech concepts with simple analogies (@sreekarreddy.com). AWS Certified β’ Azure AI Certified β’ Neo4j Professional β’ Google Data Analytics When not coding: exploring Sydney, working on side projects, and teaching tech to anyone who'll listen.
A recipe card you can reuse
Day 22 of 149
π Full deep-dive with code examples
The Recipe Card
Your mom has a recipe card for chocolate chip cookies.
Every time she wants cookies:
- She doesn't reinvent the recipe
- She just follows the card
- Same steps, same delicious cookies!
Functions are recipe cards for code!
In Code
Instead of writing the same thing over and over:
# The recipe (function)
def make_greeting(name):
return "Hello, " + name + "!"
# Use it anytime!
make_greeting("Alex") # "Hello, Alex!"
make_greeting("Sam") # "Hello, Sam!"
Write once, use many times!
The Magic
Functions can:
- Take inputs (ingredients)
- Do something (the recipe steps)
- Give output (the finished dish)
Input: name
Process: add "Hello" before it
Output: greeting
In One Sentence
Functions are reusable blocks of code that take inputs, do something, and return outputs.
π Enjoying these? Follow for daily ELI5 explanations!
Making complex tech concepts simple, one day at a time.