Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

Python-Quizzes | Python List Quiz | Question 18

  • Last Updated : 17 Sep, 2020

Question 18: Find the output of the following program:

temp = ['Geeks', 'for', 'Geeks'
arr = [i[0].upper() for i in temp] 

(A) [‘G’, ‘F’, ‘G’]
(B) [‘GEEKS’, ‘FOR’, ‘GEEKS’]
(C) [‘GEEKS’]
(D) Compilation error

Answer: (A)

Explanation: The variable i is used to iterate over each element in list temp. i[0] represent the character at 0th index of i and .upper() function is used to capitalize the character present at i[0].

Quiz of this Question

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!