Interview Q&A / Python
Python interview questions
Lists, dictionaries, generators, decorators and the Python questions asked in service-company and data roles.
Prefer rapid revision? Practise Python short interview answers →
- What are truthy and falsy values in Python?
Every object has a truth value when used in an if or while. Falsy values are False, None, zero of any numeric type, and empty containers such as '', [], (), {}, set() and range(0). Everything else is truthy unless its class defines __bool__ or __len__ to say otherwise.
BeginnerQuick answer1 min read