惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

爱范儿
爱范儿
博客园_首页
U
Unit 42
Apple Machine Learning Research
Apple Machine Learning Research
云风的 BLOG
云风的 BLOG
MongoDB | Blog
MongoDB | Blog
美团技术团队
H
Help Net Security
G
Google Developers Blog
B
Blog RSS Feed
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
aimingoo的专栏
aimingoo的专栏
Google DeepMind News
Google DeepMind News
J
Java Code Geeks
M
MIT News - Artificial intelligence
腾讯CDC
IT之家
IT之家
Vercel News
Vercel News
C
Check Point Blog
博客园 - 三生石上(FineUI控件)
Last Week in AI
Last Week in AI
I
InfoQ
博客园 - 司徒正美
A
About on SuperTechFans

噜啦 - if

django if标签 - 噜啦 django if标签 - 噜啦 while if 嵌套 - 噜啦 while if 嵌套 - 噜啦 for if 嵌套 - 噜啦 for if 嵌套 - 噜啦 条件语句 if判断 - 噜啦
条件语句 if判断 - 噜啦
博主: 噜啦 · 2019-09-06 · via 噜啦 - if

代码

x = 'abc'
a = 3
b = 4
c = 5
if x == 'abc':
    print('x的值和abc是相等的')

if a == 2:
    print('a 的值为2')
else:
    print('a 的值不为2')

if b == 2:
    print('b 的值为2')
elif b == 3:
    print('b 的值为3')
elif b==4:
    print('b 的值为4')
else:
    print('程序执行结束')
    

运行

课堂练习

chinese_zodiac = '猴鸡狗猪鼠牛虎兔龙蛇马羊'


year = int(input('请用户输入出生年份: '))

if (chinese_zodiac[year % 12] == '狗'):
    print('狗年运势!')

运行

赞赏作者

如果觉得我的文章对你有用,请随意赞赏