For the following Python statement: Txt = list('PEACE') print(Txt) What shall…

2023

For the following Python statement: Txt = list('PEACE') print(Txt) What shall be the output of print(Txt)?

  1. A.

    ['P', 'E', 'A', 'C', 'E']

  2. B.

    [P, E, A, C, E]

  3. C.

    Error in statement

  4. D.

    ['PEACE']

Attempted by 2170 students.

Show answer & explanation

Correct answer: A

The list() function converts a string into a list of its individual characters. In the given statement, list('PEACE') creates a list where each character of the string 'PEACE' becomes an element: ['P', 'E', 'A', 'C', 'E'].

Explore the full course: Rssb Senior Computer Instructor