1. Home
  2. Data Science
  3. Python
  4. Which of the following is a correct variable assignment?

Added 5 Feb 2024

Which of the following is a correct variable assignment?

  1. x = 5y
  2. 5 = x
  3. x : 5
  4. x = 5 Correct answer

Correct answer

D. x = 5

16 views

MCQSEXAM

Explanation

In Python, a variable is assigned using the format 'variable_name = value'. The correct syntax is demonstrated in option 'd'.

Reference

https://www.w3schools.com/python/default.asp

Doubts & discussion

Not sure why the answer is D? Ask here and get an explanation.

Ask a doubt about this MCQ

Shown after review. No links please.

More Python MCQs

Practise all Python MCQs

Similar MCQs