Python classic interview question one​

1. What is the difference between python2 and python? List at least five

2. What are the built-in data types of python

3. Ways to improve the efficiency of python operation

**4. What is PEP8? **

"Python Enhancement Proposal #8" (Python Enhancement Proposal #8) is also called PEP8, a style guide he compiled for the python code format.

**5. What tools can help debug or do static analysis? **

**6. How to convert tuple and list in Python? **

Just use tuple and list functions directly, type() can determine the type of the object.

**7. Please write a piece of Python code to delete duplicate elements in a list. **

Use the set function

set(list)

Use dictionary functions

a=[1,2,4,2,4,5,6,5,7,8,9,0]
b={}
b=b.fromkeys(a)
c=list(b.keys())print(c)

**8. How to generate random numbers in Python? **

The module used to generate random numbers in Python is random, which needs to be imported before use. For example:

**9. What is pass in Python? **

pass is a statement that will not be executed in Python. In complex sentences, if a place needs to be left blank temporarily, it is often used as a placeholder.

10. String formatting: the difference between% and .format

The format function of the string is very flexible and powerful. It can accept an unlimited number of parameters, and the position can be out of order, and there are more powerful format qualifiers (such as: padding, alignment, precision, etc.).

Recommended Posts

Python classic interview question one​
Python classic interview questions two
Python classic algorithm
Python review one
Python interview questions
Python interview assault
Python interview questions summary
Python basic knowledge question bank
Python interview questions: string concatenation
Python interview questions collection (three)
Python implements ten classic sorting algorithms
Python classic programming questions: string replacement