Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/python-3.x/18.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 3.x Python elif无效语法_Python 3.x - Fatal编程技术网

Python 3.x Python elif无效语法

Python 3.x Python elif无效语法,python-3.x,Python 3.x,我试图使这个elif语句,但它不断向我显示这个错误无效语法 谁能给我解释一下,谢谢 代码: 错误: File "<ipython-input-15-6032d446949e>", line 7 elif: ^ SyntaxError: invalid syntax 根据协议,elif的使用方式如下: 尝试: 如果y

我试图使这个elif语句,但它不断向我显示这个错误无效语法 谁能给我解释一下,谢谢

代码:

错误:

File "<ipython-input-15-6032d446949e>", line 7
    elif:
        ^
SyntaxError: invalid syntax
根据协议,elif的使用方式如下:

尝试:
如果y 这是您的完整代码

x = int(input("Hello, how old are you? "))
y, u, i, o, p, l, b, c, v = 0, 12, 13, 19, 20, 30, 31, 64, 65

try:
        x == int
        if y < x <= u:
                print("Kid")
        elif i < x <= o:
                print("Teenager")
        elif p < x <= l:
                print("Young Adult")
        elif b < x <= c:
                print("Adult")
        else:
                print("Senior")
except:
    print("Is that an age?")
如果。。。需要一个条件!
if(condition):
   statement
elif(condition):
   statement
x = int(input("Hello, how old are you? "))
y, u, i, o, p, l, b, c, v = 0, 12, 13, 19, 20, 30, 31, 64, 65

try:
        x == int
        if y < x <= u:
                print("Kid")
        elif i < x <= o:
                print("Teenager")
        elif p < x <= l:
                print("Young Adult")
        elif b < x <= c:
                print("Adult")
        else:
                print("Senior")
except:
    print("Is that an age?")