#Author:zyl
_username=‘zyl‘
_password= ‘zyl123‘
username= input("username:")
password = input("password:")
print(username,password)
if _username== username and _password == password:
print("welcome user {name} login...".format(name=username))
else:
print("invalid usernaem or password!")
#indentationError表示缩进错误
#if和else后都必须加冒号“:”
#Author:zyl
age_of_oldboy = 56
guess_age = int(input("guess age:")) #强制转换数据类型
if guess_age == age_of_oldboy:
print("yes,you got it.")
elif guess_age > age_of_oldboy:
print("think smaller...")
else:
print("think bigger!")
#猜年龄运用 if 语句
时间: 2024-10-13 04:40:28