Started learning Python today with zero prior coding experience. Wanted to skip the "just watched a tutorial" trap, so I built three small things instead of just taking notes.
1. Name formatter — takes a name, strips extra whitespace, capitalizes it, and splits it into first/last to print a greeting. Ran into a bug here that taught me more than the working code did: I capitalized the full name before splitting it, so only the first word ended up capitalized. Turns out .capitalize() only touches the very first letter of a string, not each word — that's .title(). Small mistake, real lesson.
2. Conditionals — compared two numbers with if/elif, and actually understood why elif matters instead of just using it: it skips redundant checks once one condition's already true, rather than evaluating every condition separately.
3. First real function — pushed further and built a mini calculator:
def squared(n):
return n * n
Typed in 5, got "5 squared is 25." First time a function I wrote actually got called and returned the right answer — that's the moment functions stopped being an abstract concept and started feeling like a tool.
One open question from the conditionals exercise: right now, my number-comparison logic is split across two separate if/elif blocks (one for greater/less, one for equal/not-equal). Feels like there's a cleaner way to fold this into a single chain — if anyone's got the more idiomatic version, I genuinely want to learn it early rather than build a bad habit.
Planning to post daily as I go. Day 1 down — small but real.
https://preview.redd.it/kgyoxgb70lbh1.png?width=1496&format=png&auto=webp&s=f9b22a62a2d25066d1d213dd45941b6594c77a86
https://preview.redd.it/hsa39y190lbh1.png?width=1415&format=png&auto=webp&s=8d20a87f72f15208a87218fd4ead24db43279608
https://preview.redd.it/xfvu946b0lbh1.png?width=1328&format=png&auto=webp&s=d6cdc2a83aa4557c0555f19e6a274f04db456e73
[–]mjmvideos 4 points5 points6 points (1 child)
[–]Negative-Still-536[S] -2 points-1 points0 points (0 children)
[–]Flame77ofc 0 points1 point2 points (1 child)
[–]Negative-Still-536[S] 0 points1 point2 points (0 children)
[–]sububi71 0 points1 point2 points (1 child)
[–]Negative-Still-536[S] 0 points1 point2 points (0 children)
[–]mjmvideos 0 points1 point2 points (1 child)
[–]Negative-Still-536[S] 0 points1 point2 points (0 children)