Python Day2
Yixin Lv4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# 标准数据类型
import math

"""
Number(数字)
String(字符串)
List(列表)
Tuple(元组)
Set(集合)
Dictionary(字典)
可变数据(3个):List(列表),Dictionary(字典),Set(集合)
代码风格整理: Ctrl + Alt +l
"""

a, b, c, d = 20, 5.5, True, 4 + 3j

print(type(a)), print(type(b)), print(type(c)), print(type(d))
# # ------------------------------------------------------------------------#
# # 此外还可以用 isinstance 来判断:
# a = 111
# isinstance(a, int)
#
# # isinstance 和 type 的区别在于:
# '''
# type()不会认为子类是一种父类类型。
# isinstance()会认为子类是一种父类类型。
# '''
#
#
# class A:
# pass
#
#
# class B(A):
# pass
#
#
# isinstance(A(), A)
#
# type(A()) == A
#
# isinstance(B(), A)
#
# type(B()) == A
# ------------------------------------------------------------------------#

# 数值运算:

5 + 4 # 加法

4.3 - 2 # 减法

  • Post title:Python Day2
  • Post author:Yixin
  • Create time:2021-05-02 15:13:21
  • Post link:https://keep.xpoet.cn/2021/05/02/simpread-Python 学习 -Day2(2021.2.25)_Yixin 的博客 - CSDN 博客/
  • Copyright Notice:All articles in this blog are licensed under BY-NC-SA unless stating additionally.
 Comments