Question Detail

COS 102 lecture 4 Objective Question

Question

Which statement best describes how a variable is created in Python?
Options
A Variables must be declared using a specific <code>declare</code> keyword before use.
B A variable is created the moment you first assign a value to it.
Correct Answer
C Variables are declared with a fixed type and cannot change type later.
D A variable must first be registered with the Python interpreter before assignment.
Correct Answer

Option B is the correct answer.

Detailed Explanation

Page 28 clearly states, "A variable is created the moment you first assign a value to it." It also mentions that variables do not need to be declared with any particular type and can even change type.

Hint

Think about the very first step you take when you want to use a variable in Python.

Question Info