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 the different ways to format strings in Python, and which should you prefer?
Python has % formatting, str.format() and f-strings. Prefer f-strings (3.6+): they are the most readable and usually the fastest, because expressions are written directly inside the string.
BeginnerQuick answer1 min read