epf是else if的简写。else和epf语句也可以叫做子句,因为它们不能独立使用,两者都是出现在if、for、while语句内部的。else子句可以增加一种选择;而epf子句则是需要检查更多条件时会被使用,与if和else一同使用。
实例:
people = 30
cars = 40
buses = 15
if cars > people:
print( "We should take the cars.")
epf cars < people:
print ("We should not take the cars.")
else:
print ("We can't dicide.")
if buses > cars:
print ("That's too many buses.")
epf buses < cars:
print ("Maybe we could take the buses.")
else:
print ("We still can't decide.")
if people > buses:
print ("Alright, let's just take the buses.")
else:
print ("Fine, let's stay home then.")
运行结果:
更多Python相关技术文章,请访问Python教程栏目进行学习!
以上就是小编分享的关于python中的elif是什么意思的详细内容希望对大家有所帮助,更多有关python教程请关注环球青藤其它相关文章!