Which of the following is a correct variable assignment?
-
A
x = 5y
-
B
5 = x
-
C
x : 5
-
D
x = 5
Correct answer
16 views
Explanation
In Python, a variable is assigned using the format 'variable_name = value'. The correct syntax is demonstrated in option 'd'.
Doubts & discussion
Not sure why the answer is D? Ask here and get an explanation.
Ask a doubt about this MCQ