← Home
Python Interview Coding Questions
Real interviews blend tracing with short coding tasks. Use Interview Prep mode for company-tagged generation.
Example problems
Short-circuit
def f():
print('f')
return 1
print(0 and f())
print(1 or f())Output: 0
1
Default arg
def h(lst=[]):
lst.append(1)
return lst
print(h(), h())Output: [1] [1, 1]
Enumerate
d = 0
for i, c in enumerate('ab'):
d += i + ord(c)
print(d)Output: 196