# pcj例子一:
‘‘‘先把用户名与密码存到一个变量,然后与用户输入的对比,如果成立,则打印,欢迎login,else invalid username or password‘‘‘_username="pcj" _password="123"username=input("username")password=input("passwrod")if _username==username and _password==password: print("welcom user {name} login....".format(name=username)) #必须要缩进,理解为这一句是if 的子语句else: print("invalid username or password") 例二:输入年龄
# pcjage_oldBoy = 56age = int(input("age:")) #系统默认输入的都是字符,所以必须要int一下if age_oldBoy == age: print("yes you got it")elif age_oldBoy < age: print("输入大了")else: print("输入小了")
原文地址:https://www.cnblogs.com/pcjbk/p/10940639.html
时间: 2024-10-09 08:06:43