#_*_coding:utf-8_*_
#!/usr/bin/env python
#取余/模
a=10
b=3
print(a%3)
x=1
y=3
print(x%3)
#真正的除法/
print(2/3)
#地板除://,得到的结果是整数(商)
print(2//3) #得0
#逻辑运算
#逻辑与
print(True and False)
print(1 and ‘‘) #1的布尔值True,‘‘的布尔值False,所以1 and ‘‘ ---> True and False 得False-->‘‘
#逻辑或
print(True or False)
print(1 or ‘‘)
#in /not in
# 字典的成员运算针对的是key
print(‘a‘ in {‘a‘:1,‘b‘:2})
#is /is not
a=1
print(a is 1)
print(type(a) is int)
l=[]
print(type(l) is list)
d={}
print(type(d) is dict)
msg=‘hello‘
print(type(msg) is str)
t=()
print(type(t) is tuple)
# msg=‘‘
# print(msg+‘hello‘)
msg=‘abc‘
print(msg*12)
print(‘====‘*30)
l=[1,2]
print(l+[3])
print(l*3)
时间: 2024-10-16 18:12:15