如果条件满足,我试图在for循环中增加一个变量(计数)。但是,在递增语句中出现语法错误。请帮忙。
def count_ans():
count=0
for m in range(0,4):
if quiz_dict[q_nos[m]==ans_list[m]:
count += 1 #<--syntax error
return count
答案 0 :(得分:0)
Folllwong应该是函数
def count_ans():
count=0
for m in range(0,4):
if quiz_dict[q_nos[m]]==ans_list[m]: ##### Square bracket was missing
count += 1
return count #### Return was outside the function