Lai Yonghao (http://laiyonghao.com)
Today, I saw a collection of Python interview questions (simple-is-better.com) IN THE http://simple-is-better.com/news/596, which has some good questions, such as "How is Python type conversion ?", There are also some questions that make people vomit blood, such as "How to Implement the singleton mode in Python? How to Implement the other 23 Design Patterns in Python ?". At the same time, I was asked to share and discuss the python questions I used in my previous recruitment with you. The questions are as follows. Please give me more advice.
Python questions (based on Python 2.3 or later)
====================
I. Culture
----
1. Have you heard of the Zen of python? Write it silently as much as possible. Both Chinese and English are acceptable. If you have never heard of it, let's talk about your views on pythonic, or what kind of Python do you thinkCodeIs the good code.
Ii. Data Structure andAlgorithm
---------
2. Now there is a dict object, adict, which contains 1 million elements. How many times does it take to find an element on average? Where are the 10 million elements?
3. Now there is a list object alist. All the elements in it are strings. Write a function to sort it in a case-insensitive manner.
4. Which of the following modules about the "Heap" Data Structure in Python? What are the advantages and disadvantages of "heap? For example, heap may be used in Game Development (not limited to Python heap, but can be implemented in other languages ).
5. In which version of Set Becomes build-in types? For example, a problem where you used this data structure in previous projects (not limited to Python set, which can be related to implementations in other languages ), it also explains why the set data structure was selected.
6. There is an sorted list object alist to find whether there is element a (use the standard library function as much as possible ).
Iii. Database Application
-----
7. The items () method of dict is different from that of iteritems.
8. Write a paragraphProgramRead a text file line by line and print it out on the screen.
9. Write as many STR objects as possible.
10. disrupt an sorted list object alist.
11. There is a two-dimensional list object (each of its elements is a list object) alist. Assuming that all the elements have the same length (think of alist as a table ), write a program to sort the second element of the element (that is, sort the second column of the table ).
Iv. Design
----
12. Implement a stack.
13. Compile a simple INI file interpreter.
14. There are n English files in plain text format to implement a retrieval scheme, that is, a small search engine.