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)?
Answer: A. ['P', 'E', 'A', 'C', 'E'] — 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…
- A.
['P', 'E', 'A', 'C', 'E']
- B.
[P, E, A, C, E]
- C.
Error in statement
- D.
['PEACE']
Attempted by 2354 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'].
Loading lesson…