
-----学习视频来源于马士兵教育-----
内容主要为了自己复习用,也可以让大家梳洗思路
###if循环
money=1000
mrmb=int(input('输入取款金额:'))
if money>=mrmb:
money=money-mrmb
print('取款成功,余额为:',money)
else:
money = money - mrmb
print('取款失败',money)
#90-100 A
#80-89 B
#70-79 C
#60-69 D
#0-59 E
score=int(input('请输入一个数字0-100:'))
if score>=90 and score<=100:
#if 90<=score<=100:
print('A')
elif score>=80 and score<=89:
# if 80<=score<=89:
print('B')
elif score>=70 and score<=79:
# if 70<=score<=79:
print('C')
elif score>=60 and score<=69:
# if 60<=score<=69:
print('D')
elif score>0 and score<=59:
# if 0=score<=59:
print('E')
else:
print('成绩不合格')
ans=input('是会员吗:') #是
money=float(input('请输入你的金额:')) #200
if ans=='yes':
print('会员')
if money>=200:
print('8%',money*0.8) #160
elif money>=100:
print('7%',money*0.7)
else:
print('9%',money*0.9)
else:
if money>500:
print('ok',money*0.98)
else:
print('no会员',money)
#整合版if
a=int(input('nub1:')) #10
b=int(input('nub2:')) #20
print(str(a)+'>='+str(b) if a>=b else str(a)+'<'+str(b)) #10<20
##pass语句,什么都不用做,只是一个占位符,用到需要写语句的地方
money=1000
if money>=222:
pass
else:
pass
最后
以上就是英勇航空最近收集整理的关于python笔记(三):if循环语句的全部内容,更多相关python笔记(三)内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复