Python sample question with answer 12

Question:
What is the output of the following code?

failed_attempts = 3
failed_attempts = 4
print(failed_attempts)
  1. 3
  2. 4
  3. 7
  4. 3, 4
Answer:
B - is the correct answer. The output of the code is 4. This code initially assigns the value of failed_attempts to 3, but it then reassigns the value of this variable to 4 before printing it. The print() function is placed after this and displays this reassigned value of 4