第5天python学习

python开发IDE:pycharm (专业版)  eclipse

 成员运算:in  not in

name="老男孩"
#"老男孩":是字符串
# "老" :单个表示字符
#"男孩":子字符串,子序列
if "老" in name:#表示老字是否在name字符串里面
print("ok")
else:
print("Error")

if "老1" not in name:#表示老字是否在name字符串里面
print("ok")
else:
print("Error")

算数运算:+ - * / % //
n1=9
n2=2
jia=n1+n2
jian=n1-n2
cheng=n1*n2
chu=n1/n2
yu=n1%n2
shang=n1//n2
chengfang=n1**n2

print(jia)
print(jian)
print(cheng)
print(chu)
print(yu)
print(shang)
print(chengfang)

比较运算:> < = >=  <=  !=(<>)不等于


逻辑运算:and or not
True OR ==>True
True AND ==>继续判断
Flase OR ==>继续判断
Flase AND==>Flase

赋值运算:- + // %
count=count+1 ==>count+=1
count=count-1   ==>count1=1
 
 

posted on 2019-08-26 22:08  坚持是多么伟大的事情  阅读(211)  评论(0编辑  收藏  举报