Python interview questions. Part I. Junior
Python interview questions. Part I. Junior

I am starting a series of posts about my own base of interviewing questions. Of course, it is not full and it doesn't have any answers and maybe some of the questions seem weird or even stupid, but I think they are good for finding the right candidate for Python position.


Q: What is Python? What are the key features of Python?

Q: What Python libs did you use?

Q: What is pass in Python?

Q: What is lambda in Python?

Q: What is docstring in Python?

Q: What is the ternary operator in Python? Example?

Q: What are *args, **kwargs?

Q: What is the difference between list and tuple in Python?

Q: What are the built-in types that Python provides? Which are mutable which are immutable?

Q: In Python what is slicing?

Q: What keywords can be used in conjunction with the keyword `for`?

Q: How to list object methods in Python?

Q: How to get documentation of object in Python?

Q: What can be the key in the dictionary?

Q: What is `yield` in Python?

Q: How can I swap the values of two variables in Python?

Q: What is duck typing?

Q: What the difference between packages and modules?

Q: What is PEP 8?

Q: What is self?

Q: What is __init__.py module? What it's for?

Code involving questions:

Q: How to translate a string containing a binary code (1 and 0) into a number (integer)? Write a program for this.

Q: How to check that tuple A contains all elements of tuple B. Both tuples contain unique values? Write a program for this.

Q: What will be the output of the following code?

def f():
     x = 15
x = 12

Q: How to convert a string to a number which consists of letters ASCII code. Example: 'abcd' -> 979899100. Write a program for this.

Q: How to remove empty lines from a sheet of lines (with a length of 0). Write a program for this.

Q: Write a program that counts all distinct pairs with difference equal to k

Q: Build a string with the numbers from 0 to 100, "0123456789101112..."

Q: Making a list with the unique element from a list with duplicate elements

Q: Make a prime number list from (1,100)




Python interview questions. Part II. Middle

Python interview questions. Part III. Senior