Still worrying about the Python interview? After learning these points, my mother will no longer worry about my interview.

Afraid of making mistakes in the interview? The question asked by the interviewer is unknown? Remember the following knowledge points, the interview is no longer a problem.

1. What exactly is Python?

Answering Tips: Comparing to Other Technologies

Here are some key points:

1. Python is an interpreted language. As a side note, unlike the C language and C-derived languages, Python code does not need to be compiled before it can be run . Other interpreted languages ​​include PHP and Ruby .

2. Python is a dynamically typed language, which means that when you declare a variable, you do not need to specify the type of the variable . You can directly write codes like x=111 and x="I'm a string", and the program will not report an error.

3. Python is very suitable for object-oriented programming (OOP) because it supports the definition of classes (classes) through composition and inheritance .

4. There is no access specifier (access specifier, similar to public and private in C++) in Python. The basis for this design is "everyone is an adult."

5. In the Python language, functions are first -class objects. This means that they can be assigned to variables, and functions can either return function types or accept functions as input. A class is also a first-class object.

6. Python code is fast to write , but it usually runs slower than compiled languages .
insert image description here

2. What is PEP8?

PEP8 is a programming specification with recommendations on how to make your programs more readable. Its main content includes code layout, document layout, use of spaces, comments, document descriptions, naming conventions, coding suggestions, etc.

3. What is pickling and unpickling?

The Pickle module reads in any Python objects, converts them to strings, and dumps them into a file using the dump function—a process called pickling .

Conversely, the process of extracting raw Python objects from stored string files is called unpickling.

4. How is Python interpreted?

Python is an interpreted language, its source code can be run directly . The Python interpreter converts the source code into an intermediate language , and then translates it into machine code for execution .

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

PyChecker is a static analysis tool that not only reports errors in source code, but also reports error types and complexity. Pylint is another tool for verifying that modules meet code standards.

insert image description here

6. What are Python decorators?

Python decorators are Python- specific changes that make it easier to modify functions .

7. What is the difference between an array and a tuple?

The difference between arrays and tuples: the contents of arrays can be modified, while the contents of tuples are read-only . Additionally, tuples can be hashed, e.g. as dictionary keys.

8. How are parameters passed by value and passed by reference implemented?

Everything in Python is a class , and all variables are references to an object . The value of the reference is determined by the function and therefore cannot be changed. But if an object is modifiable, you can modify the object.

9. What are dictionary comprehensions and list comprehensions?

They are syntactic structures that allow easy creation of dictionaries and lists .

10. What data structures does Python have?

Python's own data structures are divided into mutable and immutable . Variables are: arrays, collections, dictionaries; immutable are: strings, tuples, numbers.

11. What is lambda in Python?

This is an anonymous function that is often used as a single expression in code .

insert image description here

12. Why does lambda have no statement?

The reason why an anonymous function lambda has no statement is that it is used to construct a new function object and return it when the code is executed .

13. What is pass in Python?

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

14. What is a traverser in Python?

Traversers are used to iterate over a set of elements , such as a container such as a list .

15. What is unittest in Python?

In Python, unittest is a unit testing framework in Python . It has features that support shared scaffolding, automated testing, pausing code during tests, iterating different tests into groups , and more.

16. What is slicing in Python?

Slicing is a syntax for slicing a segment in an ordered object type (array, tuple, string) .
insert image description here

Guess you like

Origin blog.csdn.net/Z987421/article/details/132473021