Today was all about decisions. With if, elif, and else, I made Python think like a mini-brain. 🧠
Depending on the age I typed, it gave different responses, from “Enjoy your youth” to “Life keeps getting better.” It feels like I’m teaching Python how to reason!
😊😊😊🤭
Top comments (2)
Nice work! Once you get comfortable with if-elif-else, you might also enjoy trying out Python's match-case. It's like the little sibling of if-else. Sometimes cleaner and more readable when checking multiple conditions. 😉
Here’s the same example using match-case with a little improvement. We check if the input is less than 1, as it cannot be real:
If you feel like it, try adding another check to show the same message if an age greater than 120 is entered. ☺️
I am definitely trying it.. 🥰🤭🙏🏾