博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
python中number
阅读量:4053 次
发布时间:2019-05-25

本文共 2903 字,大约阅读时间需要 9 分钟。

To delete the reference to a number object using del. The syntax of the del statement is: del var1[,var2[,var3[....,varN]]]]

 

Python中不同数据类型之间的转换规则(限number)

1 复数 2 浮点数 3 长整形  4 整形

 

绝对值函数abs对复数的作用则是 x+yi  abs=xX+ yy开平方

 

Number Type Conversion:

  • Type int(x) to convert x to a plain integer.

  • Type long(x) to convert x to a long integer.

  • Type float(x) to convert x to a floating-point number.

  • Type complex(x) to convert x to a complex number with real part x and imaginary part zero.

  • Type complex(x, y) to convert x and y to a complex number with real part x and imaginary part y. x and y are numeric expressions

Built-in Number Functions:

Mathematical Functions:

Python includes following functions that perform mathematical calculations.

Function Returns ( description )
The absolute value of x: the (positive) distance between x and zero.
The ceiling of x: the smallest integer not less than x
-1 if x < y, 0 if x == y, or 1 if x > y
The exponential of x: ex
The absolute value of x.
The floor of x: the largest integer not greater than x
The natural logarithm of x, for x> 0
The base-10 logarithm of x for x> 0 .
The largest of its arguments: the value closest to positive infinity
The smallest of its arguments: the value closest to negative infinity
The fractional and integer parts of x in a two-item tuple. Both parts have the same sign as x. The integer part is returned as a float.
The value of x**y.
x rounded to n digits from the decimal point. Python rounds away from zero as a tie-breaker: round(0.5) is 1.0 and round(-0.5) is -1.0.
The square root of x for x > 0

Random Number Functions:

Random numbers are used for games, simulations, testing, security, and privacy applications. Python includes following functions that are commonly used.

Function Returns ( description )
A random item from a list, tuple, or string.
A randomly selected element from range(start, stop, step)
A random float r, such that 0 is less than or equal to r and r is less than 1
Sets the integer starting value used in generating random numbers. Call this function before calling any other random module function. Returns None.
Randomizes the items of a list in place. Returns None.
A random float r, such that x is less than or equal to r and r is less than y

Trigonometric Functions:

Python includes following functions that perform trigonometric calculations.

Function Description
Return the arc cosine of x, in radians.
Return the arc sine of x, in radians.
Return the arc tangent of x, in radians.
Return atan(y / x), in radians.
Return the cosine of x radians.
Return the Euclidean norm, sqrt(x*x + y*y).
Return the sine of x radians.
Return the tangent of x radians.
Converts angle x from radians to degrees.
Converts angle x from degrees to radians.转化为弧度

Mathematical Constants:

The module also defines two mathematical constants:

Constant Description
pi The mathematical constant pi.
e The mathematical constant e.

转载地址:http://snxci.baihongyu.com/

你可能感兴趣的文章
java 不用递归写tree
查看>>
springboot2 集成Hibernate JPA 用 声明式事物
查看>>
fhs-framework jetcache 缓存维护之自动清除缓存
查看>>
SpringBoot 动态编译 JAVA class 解决 jar in jar 的依赖问题
查看>>
fhs-framework springboot mybatis 解决表关联查询问题的关键方案-翻译服务
查看>>
ZUUL2 使用场景
查看>>
Spring AOP + Redis + 注解实现redis 分布式锁
查看>>
elastic-job 和springboot 集成干货
查看>>
php开发微服务注册到eureka中(使用sidecar)
查看>>
mybatis mybatis plus mybatis jpa hibernate spring data jpa比较
查看>>
支付宝生活号服务号 用户信息获取 oauth2 登录对接 springboot java
查看>>
CodeForces #196(Div. 2) 337D Book of Evil (树形dp)
查看>>
uva 12260 - Free Goodies (dp,贪心 | 好题)
查看>>
uva-1427 Parade (单调队列优化dp)
查看>>
【设计模式】学习笔记13:组合模式(Composite)
查看>>
hdu 1011 Starship Troopers (树形背包dp)
查看>>
hdu 1561 The more, The Better (树形背包dp)
查看>>
【设计模式】学习笔记14:状态模式(State)
查看>>
poj 1976 A Mini Locomotive (dp 二维01背包)
查看>>
Java链式编程(Stream流)
查看>>