网络编程
位置:首页>> 网络编程>> Python编程>> Python中if elif else及缩进的使用简述

Python中if elif else及缩进的使用简述

作者:初始化人生  发布时间:2021-06-18 18:29:36 

标签:python,if,elif,else,缩进

代码如下所示:


scole = input("input your scole:")
if scole>90:
 print("A")
elif scole>80:
 print("B")
elif scole>70:
 print("C")
elif scole>60:
 print("D")
elif scole>50:
 print("E")
else :
 print("OUT")

哪项先符合条件,就只执行此项。

 所有的缩进要一致,

 可以使用TAB键,但不建议,因为在不用系统中会有不同,不便移植。

 建议使用4个空格键,可以吧TAB键输入设置成自动转化成4个空格键。

总结

以上所述是小编给大家介绍的Python中if elif else及缩进的使用网站的支持!

来源:https://blog.csdn.net/Lcd_Init/article/details/80526316

0
投稿

猜你喜欢

手机版 网络编程 asp之家 www.aspxhome.com