1.条件语句
缩进用4个空格
#a. n1 = input(‘>>>‘) if "alex" == "alex" n2 = input(‘>>>‘) if n2 == "确认" print(‘alex SB‘) else: print(‘alex DB‘) else: print(‘error‘) #注意:n1="alex" 赋值 # n1=‘alex‘ 比较 #b. if 条件1: pass elif 条件2: pass elif 条件3: pass else: pass print(‘end‘) #c. 条件1 and or if n1 == "alex" or n2 == "alex!123": print(‘OK‘) else: print(‘OK‘) # pass 代指空代码,仅仅用于表示代码块
原文地址:https://www.cnblogs.com/a505721883/p/8849511.html
时间: 2024-11-07 21:49:01