score = int(input("输入分数:")) if score > 100: print("最高分才100...") elif score >= 90: print("A") elif score >= 60: print("C") elif score >= 80: print("B") elif score >= 40: print("D") else: print("太笨了...E")
比较分数
name = input('请输入名字:') age = input('请输入年龄:') if name == '小二': if age == '18': print(666) else: print(333) else: print('错了....')
if条件判断
print('111') while True: print('我们不一样') print('在人间') print('痒') print('222')
while 从一加到一百
count = 1 flag = True #标志位 while flag: print(count) count = count + 1 if count > 100 : flag = False count = 1 while count <= 100: print(count) count = count + 1 count = 1 sum = 0 while count <= 100: sum = sum + count count = count + 1 print(sum)
print('11') while True: print('222') print(333) break print(444) print('abc') count = 1 while True: print(count) count = count + 1 if count > 100:break print(111) count = 1 while count < 20 : print(count) continue count = count + 1
i = 0 while i < 3 : username = input('输入用户名: ') password = int(input('输入密码')) if username == 'kkk' and password == 123: print ('登录成功') else: print ('登录失败重新登录') i += 1
三次登录帐号密码
count = 0 while count <= 100 : count += 1 if count > 5 and count < 95: continue print("loop ", count) print("-----out of while loop ------")