如何完成这while回圈

我想要的是可以一直问问题,而且回答年龄小於1就会break,在年龄在6跟12之间再问有没有父母

在线等...

我目前写的如下:

age=int(input("请输人你的年纪:"))

while True:

    if age >=6 and age <=12:
            with_parent = input("和父母一起来吗?(Y/N)")
            if (age >= 6 and age <= 12) and (with_parent == 'Y' or with_parent == 'y'):
                    print("可以看保护级电影")
                    age = int(input("请输人你的年纪:"))
    if age>=18:
            print("可以看限制级电影")

    elif age >12:
            print("可以看辅导级电影")
    else:
            print("只能看普通级电影")

<<:  资安学习路上-网站常见漏洞与 Injection的爱恨情仇4

>>:  资安学习路上- Injection的爱恨情仇6

[Day11] Flutter - StatelessWidget & StatfulWidget 差别

前言 Hi, 我是鱼板伯爵今天要讲 StatelessWidget & StatfulWid...

Day12: 【TypeScript 学起来】只有 TS 才有的型别: Literal Types(字面值型别) / Tuple (元组)

工程师A: 觉得当工程师好累 想换一行怎麽办 工程师B: 按一下 enter 啊 工程师A:......

Day 14 在VSCode中使用Azure

前言 由於接下来要开始写到attention和Capsule的实作,主要是会研究一些github或是...

资安生活的日常

执行人员:工作超忙,资安什麽的就明天在处理吧... 客户:供应商内控功能疑似失效且烧到利害关系人.....

经济部工业局 2021 通讯大赛 !

https://mobilehero.com/zh-Hant ...