Identify the correct output of the following Python program. CHARR = [['A',…

2023

Identify the correct output of the following Python program. CHARR = [['A', 'B'], ['C', 'D'], ['E', 'F']] print(CHARR [1] [1])

  1. A.

    'A' / 'A'

  2. B.

    'B' / B

  3. C.

    'C' / 'C'

  4. D.

    'D' / 'D'

Attempted by 1905 students.

Show answer & explanation

Correct answer: D

Correct output: D. Interpret the nested list: CHARR = [['A', 'B'], ['C', 'D'], ['E', 'F']]. CHARR[1] selects the second sublist ['C', 'D'] because indexing starts at 0. CHARR[1][1] selects the second element of that sublist, which is 'D'. Therefore print(CHARR[1][1]) prints the character D (the console shows D without quotes).

Explore the full course: Rssb Senior Computer Instructor