Question Detail

COS 102 lecture 4 Objective Question

Question

What is the function of the assignment operator (=) in Python?
Options
A It compares two values for equality.
B It assigns the value on its right to the name on its left.
Correct Answer
C It concatenates two strings together.
D It declares a new variable without assigning a value.
Correct Answer

Option B is the correct answer.

Detailed Explanation

Page 29 explains: 'Values are assigned to variable names using a special symbol called the assignment operator (=). The = operator takes the value to the right of the operator and assigns it to the name on the left.'

Hint

Focus on the definition and explanation of the assignment operator on page 29.

Question Info