1 条件语句 2 缩进用4个空格 3 a. 4 n1 = input('>>>') 5 6 if "alex" == "alex": 7 n2 = input('>>>') 8 if n2 == "确认": 9 print('alex SB') 10 else: 11 print('alex DB') 12 else: 13 print('error') 14 15 注意: 16 n1 = "alex" 赋值 17 n1 == 'alex' 比较, 18 19 b. 20 if 条件1: 21 pass 22 elif 条件2: 23 pass 24 elif 条件3: 25 pass 26 else: 27 pass 28 29 print('end') 30 31 c.条件1 32 and or 33 34 if n1 == "alex" or n2 == "alex!23": 35 print('OK') 36 else: 37 print('OK') 38 39 PS: 40 pass 代指空代码,无意义,仅仅用于表示代码块