您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

Python中的if、else、elif语句用法简明讲解

2024/2/28 1:19:16发布21次查看
下面我们学习if语句,输入下面的代码,确保能够正确运行。
people = 20 cats = 30 dogs = 15 if people cats: print not many cats! the world is saved! if people dogs: print the world is dry! dogs += 5 if people >= dogs: print people are greater than or equal to dogs. if people people: print we should take the cars. elif cars cars: print that's too many buses. elif buses buses: print alright, let's just take the buses. else: print fine, let's stay home then.
运行结果
root@he-desktop:~/mystuff# python ex30.py
we should take the cars.maybe we could take the buses.alright, let's just take the buses.
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product