Q:

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

0

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')

The tuple ‘v’ is used to generate a list containing only vowels in the string ‘w’. The result is a list containing only vowels present in the string “hello”. Hence the required list comprehension is: [x for x in w if x in v].


  1. [x for w in v if x in v]
  2. [x for x in w if x in v]
  3. [x for x in v if w in v]
  4. [x for v in w for x in w]

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

Correct Answer:

[x for x in w if x in v]

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Python Multiple Choice Questions And Answers

This question belongs to these collections

Similar questions


need a help?


find thousands of online teachers now
What will be the output of the following Python li... >>
<< Given a string example=”hello” what is the out...