Post

Khalid | Python Tasks Adventurer 🐍
I wouldn’t say the first one is wrong 🙂 Ternary is nice for very small choices: greatest = a if a > b else b But sometimes if/else is necessary: if role == "admin": log_access(user) send_welcome_message(user) redirect_to_dashboard(user) else: show_access_denied() Here, ternary is not suitable because we are doing actions, not just choosing a value. #Python #PythonCode #Coding #Programming #CodeNewbie
English
0
1
0
116
Paylaş