Question Detail

COS 102 lecture 4 Objective Question

Question

In Python, how is a variable typically created?
Options
A By using a specific 'declare' command before its first use.
B By defining its data type explicitly before assignment.
C The moment you first assign a value to it.
Correct Answer
D Variables must be pre-declared in a global scope.
Correct Answer

Option C is the correct answer.

Detailed Explanation

Page 28 states, 'Python has no command for declaring a variable' and 'A variable is created the moment you first assign a value to it.'

Hint

Review the 'Creating Variables' section on page 28, especially how Python contrasts with other languages.

Question Info