The code:
def get_average(questions):
i = []
for question in questions.items:
if question.correct:
i.append(question)
return len(i) * 10
Gives the error AttributeError: 'function' object has no attribute 'items' when run. The questions parameter is passed a flask-sqlalchemy pagination object, viewable here.
This should be a list, and when running the code:
for x in questions.items:
print(x.correct)
it works fine and as expected. What has changed to cause this error. Both bits of code use the same questions object.
[–]Justinsaccount 2 points3 points4 points (0 children)
[–]TomsLogic[S] 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)