Which of the following correctly creates a list containing ten zeros in Python?

Options

  • A. list = (10)
  • B. list = [0] * 10
  • C. list = {0:10}
  • D. More than one of the above
  • E. None of the above

Correct Answer (Detailed Explanation is Below)

B. list = [0] * 10

Detailed Explanation

The expression [0] * 10 creates a list containing ten zero elements.