current position:Home>Python----scientific notation, assigning multiple variables at the same time, eval function, math library function, complex number (complex()), built-in numerical operation function, built-in numerical operation operator

Python----scientific notation, assigning multiple variables at the same time, eval function, math library function, complex number (complex()), built-in numerical operation function, built-in numerical operation operator

2022-11-08 06:41:54will be open today

Scientific notation uses the letter "e" or "E" as the symbol for power, with base 10, the meaning of scientific notation is as follows:

      96e4:96 times 10 to the power of 4

      4.3e-3: 4.3 times the negative third power of 10

      aeb:a*10*b

Assign values ​​to multiple variables at the same time:

variable1, variable2=expression1, expression2

eval() function:

Can parse and execute strings in the form of Python expressions, and return the results to output

plural type:

Consistent with the concept of complex numbers in mathematics, z=a+bj, a is the real part, b is the imaginary part, a and b are both floating point types, and the imaginary part is identified by j or J

Example:

12.3+4j, -5.6+7j

z=1.23e-4+5.6e+89j (what are the real and imaginary parts?)

· For complex number z, you can use z.real to get the real part and z.imag to get the ordinal part

z.real=0.000123 z.imag=5.6e+89

0x or 0X: hex

0b or 0B: binary

0O or 0o: Decimal

Built-in numeric operators

 

Built-in numerical operations

 

Number type conversion:

Numeric operators can implicitly convert the numeric type of the output result

For example, the division of two integers using the operator "/" will likely output a floating-point result.

  In addition, the built-in numeric type conversion function can be used to explicitly convert all numeric types

Convert between

type(x) digital type judgment function :

Returns the type of x, suitable for all types of judgments

math library:

copyright notice
author[will be open today],Please bring the original link to reprint, thank you.
https://en.pythonmana.com/2022/312/202211080628358180.html

Random recommended