继续浏览精彩内容
慕课网APP
程序员的梦工厂
打开
继续
感谢您的支持,我会继续努力的
赞赏金额会直接到老师账户
将二维码发送给自己后长按识别
微信支付
支付宝支付

Python课堂笔记 条件控制语句

tsning
关注TA
已关注
手记 7
粉丝 11
获赞 16

事例1
mood = False
if mood:
print('go to left')
else:
print('go to right')


事例2
ACCOUNT = 'qiyue'
PASSWORD = '123456'

print('please input account')
user_account = input()

print('please input password')
user_password = input()

if user_account == ACCOUNT and user_password == PASSWORD:
print('success')
else:
print('fail')


事例3
a = input()
print('a is ' + a)
a = int(a)
if a == 1:
print('apple')
elif a == 2:
print('orange')
elif a == 3:
print('banan')
else:
print('go shopping')


事例4
a = 1
b = 0
print(bool(a or b))

打开App,阅读手记
0人推荐
发表评论
随时随地看视频慕课网APP