jiayu -判断语句的用法和写法

# 坐高铁
tickets = input("你有几张票呀")  # 字符串
tickets = int(tickets)
# print(tickets)
# 判断
# 判断符号:>  <  ==  >=  <=  !=
# 如果票大于0,就进站:
if tickets > 0:
    print("请进站")
    booms = input("你带了几个炸弹?")
    booms = int(booms)
    if booms > 0:
        print("close the door, put a dog")
    else:
        print("go home")
elif tickets>10000:
    print("catch yellow cow")
elif tickets<0:
    print("逃票的终于被抓到了!!")
else:
    print("请出门买票!")


发布了305 篇原创文章 · 获赞 18 · 访问量 1万+

猜你喜欢

转载自blog.csdn.net/houlaos/article/details/104185893