Python issue record

Source: Internet
Author: User
Tags mathematical functions natural logarithm square root

Numeric data types are used to store numeric values.
The data type is not allowed to change, which means that if you change the value of the numeric data type, the space will be redistributed.
1.del (used to delete references to some numeric objects)
2. Shaping (int) is usually called a shape or integer, a positive or negative integer, with no decimal points.
3. Float (float) floating-point type consists of an integer part and a fractional part.
4. Negative numbers (complex) are made up of real and imaginary parts.
Numeric type conversions
1.int (x) converts x to integers
2.float (x) converts x to floating-point numbers (that is, decimals)
3.complex (x) converts the x to a negative number. The real number is divided into 0 of the imaginary part of X.
4.complex (x, Y) converts X and Y to a negative number, and the number of real parts is divided into y,x and y are numeric expressions.
Python numeric operations
1.+ (addition)
2.-(subtraction)
3.* (multiplication)
4./(with decimals)
5.//(rounding)
5.% (take remainder)
6.= (assigned value)
6.== (comparison)
7.** (Power)
Mathematical functions
1.abs (x) returns the absolute value of the number (x)
2.ceil (x) returns the integer of the number (Math.ceil (4.1) returns 5)
3.CMP (x, y) Python3 deprecated
4.EXP (x) returns the power of X
5.fabs (x) returns the absolute value of the comb (with decimals)
6.floor (x) returns the integer under X
7.log (x) returns the natural logarithm of X
8.LOG10 (x) returns the number of X logarithm in base 10
9.max () returns the maximum value of the parameter, which can be placed in sequence
10.min () returns the minimum value of the given parameter, which can be placed in sequence
11.MODF (x) returns the integer part and the fractional part,
Value after 12.pow (x, y) x**y operation
13.round (X,[,n]) set, the position of the rounding operation
14.SQRT (x) returns the square root of a number, the number can be negative, and the return type is real
Random number function
1.choice (a) randomly picks an element from the elements of the sequence. Random.choice (range (10))
2.randrange (1,100,2) returns random to the given range
3.random () randomly generated in 0.1 range
4.SEED[X] This function does not return a value
5.shuffle (LST) randomly sorts elements of a sequence
6.uniform (x, y) randomly generates a real number.

‘‘‘
Print (' del use ')
var1=[1,2,3,4,5,6]
Del Var1[2]
Print (VAR1)
Print (")

Python issue record

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.