撇号上的语法错误

时间:2018-04-19 08:34:18

标签: python python-3.x compiler-errors syntax-error

'你回答的结尾处的撇号:'正在注册为语法错误,不知道为什么因为它只是结束字符串。 我不知道该尝试什么

print('You got the following questions wrong:'
                    'Question' , incorrectnum[i] , incorrect_Q[i]
                    'You answered:' , incorrect_A[i]
                    'The correct answer was:' , correct_answers[int(incorrectnum[i])])

2 个答案:

答案 0 :(得分:0)

您需要在每个字符串/变量之间添加逗号。它应该是这样的:

print('You got the following questions wrong:',
                'Question', incorrectnum[i], incorrect_Q[i],
                'You answered:', incorrect_A[i],
                'The correct answer was:', correct_answers[int(incorrectnum[i])])

您应该在下次正确阅读语法错误,因为它通常会解释错误的位置/位置。

答案 1 :(得分:0)

您在print()函数的参数中缺少逗号。您可以使用以下内容:

print('You got the following questions wrong:',
                'Question' , incorrectnum[i] , incorrect_Q[i],
                'You answered:' , incorrect_A[i],
                'The correct answer was:', correct_answers[int(incorrectnum[i])])