value = int(input("please input a number:\n"))
if value == 1:
print("it is 1")
elif value == 2:
print("it is 2")
else:
print("it is not 1 or 2")

value = int(input("please input a number:\n"))
if value == 1:
print("it is 1")
elif value == 2:
print("it is 2")
else:
print("it is not 1 or 2")
本文标题:Python程序控制语句 :IF-ELIF-ELSE
本文链接:https://www.haomeiwen.com/subject/txhqzctx.html
网友评论