Consider the statements given below and then choose the correct output from…

2025

Consider the statements given below and then choose the correct output from the given options: D = {'S01': 95, 'S02': 96} for l in D: print(l, end="#")

  1. A.

    S01#S02#

  2. B.

    95#96#

  3. C.

    S01,95#S02,96#

  4. D.

    S01#95#S02#96#

Attempted by 75 students.

Show answer & explanation

Correct answer: A

In Python, iterating directly over a dictionary (for i in D) returns keys by default.

Using print(i, end="#") prints each key followed by #.

Hence, output is S01#S02#.

Explore the full course: Bpsc