if else 判断:
#!/usr/bin/env python
# -*- coding:utf-8 -*-
import getpass
name = input("用户名??")
pwd = ("密码???")
if name=="xiaoli"and pwd=="cmd":
print('OK')
else:
print('用户名或密码错误!')
输出:
for i in range(10):
print("loop:",i)
While循环:
c = 0
while True:
print(c)
c +=1
if c==100:
print("循环100次结束!")
break