语法错误:预期为“:”

问题描述 投票:0回答:1

我该怎么办?

我给出了这个错误:

mylist=input('please inter your condition :')
If mylist == '10' or '9' or '8':
   print('well')
   print('well done')
else if mylist == '7' or'6' or '5' or '4' or '3':
   print('mid') 
   print('moderate') 
else if mylist == '2'   or '1':
   print('weak')
else print('0')  

 File "<ipython-input-42-fc470037cf12>", line 5
    else if mylist == '7' or'6' or '5' or '4' or '3':
         ^
SyntaxError: expected ':'

我改变了 : 和 ' 之间的空格 但 .... 我该怎么办?

python python-3.x syntax-error
1个回答
-1
投票

在 Python 中,if...else 语句有三种形式:

if 语句

if...else 语句

if...elif...else 语句

© www.soinside.com 2019 - 2024. All rights reserved.