What will be the output of the following Python program?

print(list(range(1, 6, 2)))
                        

Options

  • A. [1, 2, 3, 4, 5]
  • B. [1, 3, 5]
  • C. [1, 3]
  • D. More than one of the above
  • E. None of the above

Correct Answer (Detailed Explanation is Below)

B. [1, 3, 5]

Detailed Explanation

The range(start, stop, step) function generates values starting at 1 with a step of 2, excluding 6.