Select the correct output for the following Python code. for i in range(6, 1,…

2023

Select the correct output for the following Python code. for i in range(6, 1, -2): print(end='*$$')

  1. A.

    *$$*$$

  2. B.

    *$$ *$$ *$$

  3. C.

    *$$*$$*$$

  4. D.

    *$$ *$$

Attempted by 2042 students.

Show answer & explanation

Correct answer: C

Output: *$$*$$*$$ Explanation: range(6, 1, -2) produces the sequence 6, 4, 2, so the loop runs three times.

Explore the full course: Rssb Senior Computer Instructor