11
I spent a month trying to make a number guessing game in Python and it was a mess. Then I learned about functions.
4 comments
Log in to join the discussion
Log In4 Comments
stone.lisa2mo ago
That checklist idea really helps. What was the first thing you put into a function once you saw how they worked?
10
iris9272mo ago
Honestly, @the_zara's party story is too real. My first function was just printing a dumb welcome message over and over. Felt like magic to type one word instead of that whole line ten times. It's the small wins that make it click, before you even get to the big stuff like organizing tasks.
6
the_zara2mo ago
Remember trying to make a birthday party schedule without any plan. Had a list of twenty things that all needed to happen in order, but the whole script was just one giant block of text. Forgot to order the cake because that step was buried between "inflate balloons" and "hide the goody bags." Functions are like making a checklist for each job. "Food tasks" on one card, "entertainment tasks" on another. Suddenly you can see the whole mess and fix the parts that are broken.
3
sandra_bennett591mo ago
Okay but sometimes it feels like people make a huge deal out of this stuff. It's just moving code into a little box with a name. My first project was a mess of copy-pasted lines too, and putting them in a function didn't suddenly make it a good program. It still crashed if you typed a letter instead of a number. The real fix was learning about try and except blocks, not just hiding my bad code in a function called "get_user_input".
2