学习while和if 语句的嵌套使用

时间:2020-06-30 23:07:08   收藏:0   阅读:99
age1 = 90
num = 1
while num<=10:
    age = int(input("请输入您的年龄:"))
    if age == age1:
        print("正确,结束")
        num += 10
    elif age > age1:
        print("年龄太大了!")
    else:
        age < age1
        print("年龄太小了!")
txt = "gla0428"
sz = 1
while sz <=3 :
    txt1 = input("请输入密码:")
    if str(txt1) == str(txt):
        print("欢迎使用!")
        sz = 4
    else:
        print("密码不正确,请重新输入!")
        sz += 1
    print("结束输入")

原文:https://www.cnblogs.com/guanla/p/13216087.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!