1、数字之运算 (1)整数int # 数字类型:整数int a=1 b=2 print(a + b) print(a - b) print(a * b) print(a / b) (2)小数float # 数字类型:小数float a = 1.0 b = 0.1 print(a + b) print(a - b) print(a * b) print(a / b)
1、数字之运算
(1)整数int
# 数字类型:整数inta=1
b=2
print(a + b)
print(a - b)
print(a * b)
print(a / b)
(2)小数float
# 数字类型:小数floata = 1.0
b = 0.1
print(a + b)
print(a - b)
print(a * b)
print(a / b)
2、字符串
# 数据类型:字符串stra = 'Hello!'
b = "My"
c = """name is
LiLy."""
d = '''Who are you?'''
x = ' ' #空格
print(a + b + x + c) #加法+表示字符串拼接
print("Hello world!")
print(d * 3) #乘法*表示重复次数
3、布尔
# 布尔类型:true/falsea = 10
b = 20
c = a + b
print(c)
print(a > b)
print(a < b)
print(a < c)