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

1、 Python learning notes - basic data types - numbers

編輯:Python
"""
stay Python 3 in , There is only one integer type int, Expressed as a long integer , No, python2 Medium Long.
stay Python2 There is no Boolean in , It uses numbers 0 Express False, use 1 Express True. To Python3 in , hold True and False Defined as a keyword , But their value is still 1 and 0, They can be added to numbers .
"""
""" Numeric type
Python3 Support int、float、bool、complex( The plural )
perform python command , Create various digital objects , And print type
"""
a, b, c, d = 20, 5.5, True, 4+3j
print(type(a), type(b), type(c), type(d))

Create and delete

# When you specify a value ,Number The object will be created
a = 1
b = 2
# You can also use del Statement to delete some object references .
del a, b

Numerical operation

# 1、 Division of values (/) Always return a floating point number , To get integer usage // The operator .
# 2、 In mixed calculation ,Python Will convert integer to floating point .
"""
5 + 4 # Add
4.3 - 2 # Subtraction
3 * 7 # Multiplication
2 / 4 # division , Get a floating point number
2 // 4 # division , Get an integer
17 % 3 # Remainder
2 ** 5 # chengfang
"""

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