if语句小程序示例
1、
user_name = "wang"
password = 123
inp_user_name = input(">>:")
inp_password = int(input (">>:"))
if inp_user_name == user_name and inp_password == password:
print("pass")
else:
print("fail")
2、
score = int( input(">>:")) #将input字符串转换为整形,并赋值给score
if score > 90:
print("A") #print前加四个空格
elif score > 80:
print("B")
elif score > 70:
print("C")
elif score > 60:
print("D")
else:
print("Fail")
原文地址:https://www.cnblogs.com/thumbupking/p/8847242.html
时间: 2024-09-27 04:29:01