程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
您现在的位置: 程式師世界 >> 編程語言 >  >> 更多編程語言 >> Python

Python zero basic learning - follow up master turtle

編輯:Python

Python Operator :< Less than <= Less than or equal to > Greater than >= Greater than or equal to == be equal to != It's not equal to is Judge two objects id Whether it is equal or not is not Whether two id It doesn't wait

Numeric type : Integers (integers) Floating point numbers (floating point numbers) The plural (complex numbers)

Python The integer length is not limited .

because Python Calculating floating-point numbers is inexact , for example :0.1+0.2 The result is 0.3000000000004,Python For accurate calculation, use decimal modular .import decimal a = decimal.Decimal('0.1') b = decimal.Decimal('0.2') ; You can also use e-05 Namely 0.00005, This is convenient for writing .

The plural : Real component + Imaginary part , for example x = 1+2j x.real The result is zero 1,x.imag The result is zero 2,.

Operations between integers :x + y Add    x - y reduce    x * y ride    x / y except    x // y Floor removal   x % y Remainder   -x x The opposite number of    +x x In itself    ads(x) x The absolute value of   int(x) take x Convert to integer    float(x) take x Convert to floating point   complex(re, im) Returns a complex number ,re Real component im Imaginary part   c.conjugate() return c Conjugate complex .

Floor removal : Ensure that the result of dividing two integers is an integer , Round down if not an integer


  1. 上一篇文章:
  2. 下一篇文章:
Copyright © 程式師世界 All Rights Reserved