logo

Question detail

In this Python code, which variable is local to the function? count = 10 def display(): message = "Ready" print(message)

Try the question, check the answer, then read the explanation to understand the curriculum point.

At a glance

MCQ

Type

practice

Style

Topic

Programming

Exam-style question

Try this first

In this Python code, which variable is local to the function? count = 10 def display(): message = "Ready" print(message).

  1. A.count
  2. B.display
  3. C.message
  4. D.print

Model answer

What a good answer should say

  • message

Explanation

Why this works

message is defined inside display, so it is a local variable. count is defined outside the function and is therefore global in this example.

Common mistake

No common mistake is linked to this question yet.

Related flashcards

No flashcards are published for this page yet.

Related practice questions

No questions are published for this page yet.