
🐍 Make It Pythonic
An empty list does not need a mirror. 🙂
Instead of comparing it to another empty list:
if tasks == []:
print("No tasks today")
✨ Write it the Pythonic way:
if not tasks:
print("No tasks today")
In Python, an empty list is already treated as False.
So if not tasks: simply means:
“No items here.”
#Python #PythonCode #CodeNewbie #100DaysOfCode #PythonTips

English