adplus-dvertising
frame-decoration

Question

Read the information given below carefully and write a list comprehension such that the output is: [‘e’, ‘o’]
w="hello"
v=('a', 'e', 'i', 'o', 'u')

a.

[x for w in v if x in v]

b.

[x for x in w if x in v]

c.

[x for x in v if w in v]

d.

[x for v in w for x in w]

Posted under Python

Answer: (b).[x for x in w if x in v]

Engage with the Community - Add Your Comment

Confused About the Answer? Ask for Details Here.

Know the Explanation? Add it Here.

Q. Read the information given below carefully and write a list comprehension such that the output is: [‘e’, ‘o’]