#算数运算符://:整除 %:求余 **:指数
#优先级:()高于**高于*/ // %高于+-
#多个变量赋值:
num1,float1,str1=10,0.5,'hello world'
print(num1)
print(float1)
print(str1)
#复合赋值运算符:+=,-=,*=,/=,//=,%=,**= ,先计算算数运算符,再赋值
a=4
c=10
c+=1+2#得到13,先算复合赋值运算符右边的表达式,再算复合赋值运算
print(c)
#比较运算符 (关系运算符)==,!=,>,<,>=,<=
#逻辑运算符 and(都为真返回结果才为真),or(其中一个为真就为真),not(not x 若x为真则为假,若x为假则为真)
a=1
b=2
c=3
print((a<b)and (b<c)) #true
#数字之间的逻辑运算
#and运算符,只要有一个值为0,则结果为0,否则结果为最后一个非0数字
print(0 and 1)#0
print(1 and 0)#0
print(2 and 5)#5
#or运算符,只有所有值为0结果为0,否则结果为第一个非0数字
print(4 or 5)#4
#条件语句
#input接受到的数值是str
age=(int(input('please input the age')))
if age<18:
print('ok')
if age<=16:
print('can not')
elif 18<age<=30:
print('yes')
else:
print(f'not,您输入的年龄是{age}')
#随机数的运算:1.导入random 模块
#2.random.randint(开始,结束)
import random
num=random.randint(5,9)
print(num)
#三目运算符:条件成立执行的表达式 if 条件 else 条件不成立执行的表达式
a=1
b=2
c=a if a>b else b
print(c)
#while循环:
i=0
while i<5:
print('yes')
i+=1
因本人为初学者,如有问题请指正。