栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Python

Python课堂笔记 条件控制语句

Python 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

Python课堂笔记 条件控制语句

事例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))

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/225766.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号