Daily #36 · 3 November 2026
Two endings at once Medium
What does this print?
file = "notes.txt"
print(file.endswith((".txt", ".md")))
Show the answer
D: True
Why: startswith and endswith accept a tuple and return True if any one of them matches. It must be a tuple: a list raises TypeError.
Learn it: Strings cheat sheet ↗ Run it yourself ↗