1.整形:
x=5
y=2
z=x+y
2.浮点型
f=5.20
l=5.30
z=f*l
3.字符串:
str='hello world"
4.转义字符:
print("hellow \n world") \n即为换行符
5.布尔量
t=True
f=False
print( t and f ) 输出False
布尔量的计算符号
- X and Y 与
- X or Y 或
- not X 非
本文详细介绍了Python中几种基本的数据类型,包括整形、浮点型、字符串和布尔型。通过具体的代码示例展示了每种数据类型的用法及特点,并解释了如何进行基本的操作如加法运算、字符串拼接以及布尔值的逻辑运算。
1.整形:
x=5
y=2
z=x+y
2.浮点型
f=5.20
l=5.30
z=f*l
3.字符串:
str='hello world"
4.转义字符:
print("hellow \n world") \n即为换行符
5.布尔量
t=True
f=False
print( t and f ) 输出False
布尔量的计算符号

被折叠的 条评论
为什么被折叠?