python code q2