Correct option is A
The given Python statement:
Txt = list('PEACE')
converts the string
'PEACE' into a
list of individual characters. The list() function takes an iterable (like a string) and converts it into a list where each character becomes a separate element.
Thus, the output of print(Txt) will be:
['P', 'E', 'A', 'C', 'E']
Important Key Points:
1.
list() Function: The list() function takes an iterable (such as a string) and converts it into a list, where each element of the iterable becomes a separate item in the list.
2.
String to List Conversion: In this case, the string 'PEACE' is converted into a list where each character of the string becomes an individual element of the list.
3.
List Representation: Lists are represented by square brackets [], with each element separated by a comma.
Knowledge Booster:
·
Option (b):
[P, E, A, C, E] is incorrect because it is missing quotes around the characters. In Python, the list elements need to be enclosed in quotes if they are strings.
·
Option (c): There is
no error in the statement. The list() function is used correctly.
·
Option (d):
['PEACE'] is incorrect because it would be the result of creating a list with the string 'PEACE' as a single element. However, list('PEACE') converts the string into separate characters, not a single string element.