Renaming variable names to make them logical
Adding comments to code
Using generator for last_question_id not for loop
pep8 changes
Deleted unused variables