← Quiz: Python Functions: all 15 questions
Quiz: Python Functions · Question 4 of 15
What does this print? (code)
What does this print?
x = 5
def change():
x = 10
change()
print(x)
- A.5
- B.10
- C.None
- D.Error
Answer & explanation
Correct answer: 5
The x inside the function is a new local variable; the global x is unchanged.
Can you get the rest right without peeking?
Take the timed Quiz: Python Functions quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →