└── README.mkd /README.mkd: -------------------------------------------------------------------------------- 1 | # Python Interview Questions 2 | 3 | This repository contains a number of Python interview questions that can be 4 | used when vetting potential candidates. It is not advised to use every one of 5 | these questions for the same candidate. 6 | 7 | ## Descriptive/Vocabulary Questions 8 | 9 | 1. What is Python? 10 | 11 | 1. Describe some features of Python. 12 | 13 | 1. How does Python execute code? 14 | 15 | 1. What are some built-in types in Python? 16 | 17 | 1. What are bindings, i.e., what does it mean for a value to be bound to a 18 | variable? 19 | 20 | ## Usage Questions 21 | 22 | 1. How do you create a list? 23 | 24 | 1. How do you create a dictionary? 25 | 26 | 1. What is a list comprehension? Why would you use one? 27 | 28 | 1. What is a generator? What can it be used for? 29 | 30 | 1. What is inheritance? 31 | 32 | 1. What happens if you have an error in an __init__ statement? 33 | 34 | 1. What happens in python if you try to divide by zero? 35 | 36 | 1. How can you improve the following code? 37 | 38 | ```python 39 | import string 40 | 41 | i = 0 42 | for letter in string.letters: 43 | print("The letter at index %i is %s" % (i, letter)) 44 | i = i + 1 45 | ``` 46 | 47 | Bonus points for mentioning `enumerate` and use of `str.format`. 48 | 49 | 1. How can you return multiple values from a function/method? 50 | 51 | ## Strategic Questions 52 | 53 | 1. What's the fastest way to swap the values bound to two variables? 54 | 55 | 1. What is the importance of reference counting? 56 | 57 | 1. Do functions (or methods) return something even if there isn't a `return` 58 | statement? If so, what do they return? 59 | 60 | 1. How do you reverse a list? Can you come up with at least three ways? 61 | 62 | 1. How would you merge two sorted lists? They can be any length, or empty. 63 | 64 | 1. How would you count the lines in a file? How would you do it if the file was too big to hold in memory? 65 | 66 | 67 | 68 | 69 | 70 | --------------------------------------------------------------------------------