Interview Q&A / Python

INTERVIEW Q&A · 81 QUESTIONS

Python interview questions

Lists, dictionaries, generators, decorators and the Python questions asked in service-company and data roles.

  1. 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