đ Day 6: âWhat Even Is a Function?â â Learning to Greet with Code
Today weâre tackling one of the most important building blocks of real-world programming: functions.
Whether you're writing a shopping cart app, a chatbot, or a gameâfunctions let you break your code into reusable, understandable parts. Youâll use them everywhere.
But hereâs the twist: weâre not just learning how to write themâweâre learning how to ask our AI assistant questions about them when we donât fully understand whatâs going on.
đŹ Real Talk from Todayâs Video
In todayâs walkthrough, I used Cursor to write a basic function to greet the user. Then I hit a bump.
The code said:
pythondef greet_user(name): return f"Hello, {name}!"
Looks simple, right?
But then the auto-docstring said Args: â and I thought, Wait, whatâs âArgsâ? I think it means âarguments,â like parameters we pass to the function. But I wasnât totally sure.
So, I went back to ChatGPT and asked.
And thatâs the real lesson here: learning to code with AI isnât about never being confused. Itâs about knowing when to pause, ask questions, and keep moving.
đ§Ș Mini Exercise: Build a Greeting Function with Cursor + ChatGPT
Letâs put this into practice:
Ask Cursor to generate a function that:
Asks for your name
Greets you by name
Returns the greeting
Start with this prompt:
âWrite a Python function called
greet_userthat takes a name as input and returns a greeting string.â
Look at the AI-generated docstring. Then ask ChatGPT:
What does
Args:mean?What does
Returns:mean?Why use a return instead of just printing?
Modify the function to:
Check if the name is blank and return a different greeting.
Add another function that thanks the user by name.
đĄ Reflection Prompt
Whatâs one AI-generated suggestion today that made you pause and ask âWait⊠what does that mean?â
That moment is the good stuff. Screenshot it. Write it down. Share it.
đ§” Join the conversation on LinkedIn
đïž Catch up on past days

