Summarize 25 basic concepts related to python

Python is an interpreted, interactive, object-oriented, high-level programming language. Unlike some other languages ​​that use punctuation, Python uses a lot of English words as keywords, so it is very readable. And it has less grammatical structure than other programming languages.

Python is an interpreted language: this means that your program does not need to be compiled before it is executed, but is handled by the interpreter at runtime. This feature is very similar to PERL, PHP.

Python is interactive: this means you can use a Python terminal to interact directly with the interpreter while writing a program.

Python is object-oriented: it supports object-oriented styles and various techniques for wrapping code into classes.

Python is great for programming beginners: Python is very easy to get started with and has a wide range of applications, from simple word processing to web browsing and game development.

1) What is Python? What are the benefits of using Python?

Python is a programming language with objects, modules, threads, exception handling, and automatic memory management. It's simple, simple, convenient, easy to extend, has many built-in data structures, and it's open source.

2) What is PEP8?

PEP8 is a programming specification with some advice on how to make your program more readable.
Summarize 25 basic concepts related to python

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 the original Python object from the stored string file is called unpickling.

4) How is Python explained?

Python is an interpreted language. Python source code can be run directly. The Python interpreter converts the source code into an intermediate language, which is then translated into machine code for execution.

5) How does Python manage memory?

Python's memory management is managed by a private heap space. All Python objects and data structures are in a private heap. The programmer does not have access to the heap and only the interpreter can operate on it.

Allocating memory for Python's heap space is done by Python's memory management module. Its core API provides some means of accessing the module for programmers to use.

Python has its own garbage collection system that recycles and frees unused memory for other programs to use.

6) What tools are available to help with debugging or static analysis?

PyChecker is a static analysis tool that reports errors in the source code and reports the type and complexity of the error. Pylint is another tool to verify that a module meets code standards.

7) What is a Python decorator?

The Python decorator is a unique change in Python that makes it easier to modify functions.

8) What is the difference between an array and a tuple?

The difference between an array and a tuple is that the contents of the array can be modified and the contents of the tuple are read-only. A tuple can be hashed, for example, as a dictionary key.

9) How are parameters passed by value and reference passed?

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

10) What is dictionary derivation and list comprehension?

They are grammatical structures that make it easy to create dictionaries and lists.

11) Does Python have its own data structure?

The data structures that come with Python are variable and immutable.

Variable is:

Array

set

dictionary

Immutable are:

String

Tuple

number

12) What is the Python namespace?

In Python, all names exist in a space where they exist and are manipulated - this is the namespace. It is like a box, each variable name is corresponding to an object. When the variable is queried, the corresponding object is looked up from the box.

13) What is a lambda in Python?

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

14) Why is there no statement for lambda?

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

15) What is the pass in Python?

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

16) What is a traversal in Python?

The traversal is used to traverse a set of elements, such as a container like a list. ,

17) What is unittest in Python?

In Python, unittest is a unit testing framework in Python. It supports shared builds, automated testing, pauses code in tests, iterates through different tests, and more.

18) What is slicing in Python?

Slicing is a syntax for excerpting a segment in an ordered object type (array, tuple, string).

19) What is a generator in Python?

A generator is a mechanism for implementing iterators. The implementation of its function depends on the yield expression, but it is no different from ordinary functions.

20) What is docstring in Python?

The docstring in Python is called docstring, which is used to generate documentation for functions, modules, and class comments in Python.

21) How to copy an object in Python?

If you want to copy an object in Python, most of the time you can use copy.copy () or copy.deepcopy (). Not all objects can be copied.

22) What is the negative index in Python?

Sequence indexes in Python can be positive or negative. If it is a positive index, 0 is the first index in the sequence, and 1 is the second index. If it is a negative index, (-1) is the last index and (-2) is the second to last index.

23) How to convert a number into a string?

You can use the built-in function str() to convert a number to a string. If you want octal or hexadecimal numbers, you can use oct() or hex().

24) What is the difference between Xrange and range?

Xrange returns an xrange object, and range returns an array. Regardless of the size of the range, Xrange uses the same memory.

25) What are the modules and packages in Python?

In Python, modules are a way to build programs. Every Python code file is a module and can reference other modules such as objects and properties.

A folder containing a lot of Python code is a package. A package can contain modules and subfolders.


Printer

Rollo Printer,Barcode Printer,Thermal Transfer Printer,Bluetooth Receipt Printer

SUNLUX IOT Technology (Guangdong) INC. , https://www.sunluxbarcodereader.com

Posted on