The text and pictures in this article come from the network, only for learning, exchange, do not have any commercial purposes, copyright belongs to the original author, if you have any questions, please contact us to deal with

The following article is from the author of Tencent Cloud: The Tao of Python

(Want to learn Python? Python Learning exchange group: 1039649593, to meet your needs, materials have been uploaded to the group file stream, you can download! There is also a huge amount of new 2020Python learning material.)

Pen test

  1. What data structures are commonly used in Python? Please give us a brief introduction.

  2. Briefly describe the differences between single, double, and triple quotation marks in Python.

  3. How to set a global variable in a function?

  4. How do I copy an object in Python? (The difference between assignment, shallow copy and deep copy)

  5. If the contents of CUSTName string are UTF-8 characters, how to convert the contents of CUSTName to GB18030 string?

  6. Write a Python code that removes duplicate elements from a list.

  7. What do these two parameters mean: args *kwargs?

  8. Count the following list words and their occurrences.

a=[‘apple’, ‘banana’, ‘apple’, ‘tomato’, ‘orange’, ‘apple’, ‘banana’, ‘watermeton’]

  1. Sort the dictionaries in the list: Suppose you have the following list object

alist=[{“name”:”a”, “age”:20}, {“name”:”b”, “age”:30}, {“name”:”c”, “age”:25}]

Sort the elements in Alist from largest to smallest by age.

  1. Write the results of the following code

a = 1 def fun(a): a = 2 fun(a) print(a)

a = [] def fun(a): a.append(1) fun(a) print(a)

class Person: name = ‘Lily’

p1 = Person() p2 = Person() p1.name = ‘Bob’ print(p1.name) print(p2.name) print(Person.name)

  1. Suppose we have two lists: a = [‘a’, ‘b’, ‘c’, ‘d’, ‘e’], b = [1, 2, 3, 4, 5], merge a and b into dictionaries.

  2. Using python’s existing data structures, simply implement a stack structure.

Questions from the interviewer

  1. What are the difficulties encountered in the project? How to solve it?

  2. How is data de-duplicated, cleaned, and stored in a database?

  3. If you have an array that goes up and then down, like 1356742, how do you find 2?

  4. How to find the lowest common ancestor of two nodes in a binary tree?

  5. What are the sequences of mysql?

  6. What anti-crawl mechanisms are encountered? How to solve it?

Can you answer all of these questions?