# 逻辑运算符# 与and 或or 非notprint((10>20)and(10<20))# false and true -> false ,只运算半边print((10>20)or(10<20))# false or true -> true print(not(10<20))# not true -> false'''
结果
False
True
False
'''
Section 2 循环语句
'''
for 循环格式
for xxx in xxx:
'''# 计算 1-100 的和sum=0for i inrange(1,101):# i 从1到100sum=sum+ i # for循环i自增不用管print(sum)'''
结果
5050
'''
'''
while 循环格式
while 循环条件 :
statement
条件满足时执行statement,条件不满足就跳出次循环
'''# 计算1-100的和sum=0
i =0while i<=100:sum=sum+ i
i = i +1# i的自增必须自己写!! 区别for循环print(sum)'''
结果
5050
'''