python - 为什么我在 Python 上使用 If 时会出现语法错误
问题描述
我是 Python 的一个真正的新手(现在已经这样做了大约 3 天),我有一个任务要求我创建一个对话。它开始很好,直到第 13 行我使用了 if 但它告诉我存在语法错误。我已经仔细检查了很多次,看看我是否遗漏了一些东西(变量是已知的,有一个冒号等......)但我无法指出哪里出了问题,所以我把它贴在这里。这是代码
nom=input("Quel est votre nom?")
print('Enchanté',nom,'je suis Roxanna, et je vais vous aider à trouver votre orientation, je suis en quelque sorte une CPE virtuelle')
print('Bien, pour commencer, veuillez choisir votre matière préférée au Lycée parmi cette liste;')
print('SVT , SES , Arts , Langues Vivantes , EPS , SNT , Histoire, Maths')
matiere=input("Quelle est votre matière préférée")
if matiere=="SVT" or matiere=="SES" or matiere=="Maths" or matiere=="Arts" or matiere=="Langues Vivantes" or matiere=="EPS" or matiere=="SNT" or matiere=="Histoire" :
print("Je vois que vous avez un préférence pour la matière suivante:",matiere, ", nous pouvons donc continuer")
else:
print("Erreur, la matière que vous avez choisie ne fait pas partie de la liste, vérifiez bien l'orthographe des mots!")
note=int(input("Combien avez-vous eu de moyenne en "+matiere+" en Terminale?")
if note>13 :
print("Très bien, vous êtes un as en"+matiere)```
解决方案
note=int(input("Combien avez-vous eu de moyenne en "+matiere+" en Terminale?")
您在)
此行的末尾缺少 a 。
推荐阅读
- python - 处理两个不同月份的两个日期的计算
- node.js - 使用 mongoose 在 mongodb 中存储 ArrayBuffer
- firebase - 无法使用链接到 Squarespace 的自定义域设置动态链接
- python - python:类函数返回值但不可用
- magento - 无法打开 magento 1.9 管理面板
- mysql - 如何在价格历史表中删除所有产品但保留 N 个最新行
- c - 如何知道哪个线程正在执行一个函数?
- node.js - 使用来自 localhost:8081 的请求对象从 NodeJs app.post 调用 localhost:8080 payara 服务器不起作用
- microsoft-graph-api - 存档邮箱的图形 API 失败
- can-bus - 在 100ms 内禁用 CAP1 中的一个信号