2019.9.9 jobs

1. Briefly two ways to execute Python programs as well as their advantages and disadvantages:

A: Interactive (jupyter), write a line one line, easy to debug execution inconvenient save

Invoke the command line (pycharm) cmd in the python to open the file in a specified path, easy to write, save, low efficiency

2. Description of Python garbage collection:

A: In order to ensure not take up too much computer memory, when referring to a variable after the body count is 0, Python will clean up this data after a certain time.

3. For the following codes:

x = 10
y = 10
z = 10
del y

10 reference count of how many?

10 reference count is 2

x = 257
y = x
del x
z = 257

Corresponding to the variable x 257 reference count of how many?

The reference count 257 is 2

4. For x = 10, please use the Python code print variable values, respectively, the memory address of the variable value and the variable data types:

x = 10
print(x,id(x),type(x))

5. For the following codes:

x = 257
y = x
z = 257

Please judge x, y, z values ​​of the variables are the same? x, y, z where the memory address is the same? Please elaborate why the python code?

Same variable value xyz,

Memory address, x, the same y, z are related to different

>>> print(x == y,x== z,y == z)
True True True
>>> print(x is y ,x is z,y is z)
True False False

6. Description of numeric type

A: The numbers are divided into integer type (int, no decimal point) and floating point (float, decimal point)

7. Type Description String

A: STR can be used (), single and double quotation marks, three marks to define, support + (string concatenation), * integer (integer string)

Guess you like

Origin www.cnblogs.com/agsol/p/11492170.html