Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

Python-Quizzes | Python List Quiz | Question 20

  • Last Updated : 17 Sep, 2020

Question 20: Find the output of the following program:

data = [x for x in (x for x in 'Geeks 22966 for Geeks' if x.isdigit()) if
(x in ([x for x in range(20)]))] 

(A) [2, 2, 9, 6, 6]
(B) [ ]
(C) Compilation error
(D) Runtime error

Answer: (B)

Explanation: Since here x has not been converted to int, the condition in the if statement fails and therefore, the list remains empty.

Quiz of this Question

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!