Question 39

For the following Python statement Txt=list ('PEACE')

For the following Python statement Txt=list ('PEACE') What shall be the output of print (Txt)?
  1. A['P', 'E', 'A', 'C', 'E']
  2. B[P, E, A, C, E]
  3. CError in statement
  4. D['PEACE']
Show answerHide answer

Correct answer: (A) ['P', 'E', 'A', 'C', 'E']

Explanation

list() on a string makes a list of its individual characters, so list('PEACE') gives ['P', 'E', 'A', 'C', 'E'].

From DSSSB TGT Computer Science Practice Set 3

This is question 39 of DSSSB TGT Computer Science Practice Set 3. See all questions of this paper with answers, or attempt the paper as a timed online test to get your score and all-India rank.