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='*$$')
- A.
*$$*$$ - B.
*$$ *$$ *$$ - C.
*$$*$$*$$ - 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.