M

Mr. Dubey • 100.69K Points
Coach

Q. , x is even} (including zero)

  • (A) [x for x in range(1, 20) if (x%2==0)]
  • (B) [x for x in range(0, 20) if (x//2==0)]
  • (C) [x for x in range(1, 20) if (x//2==0)]
  • (D) [x for x in range(0, 20) if (x%2==0)]
Share

Explanation by: Mr. Dubey
the required list comprehension will print a whole number, less than 20, provided that the number is even. since the output list should contain zero as well, the answer to this question is: [x for x in range(0, 20) if (x%2==0)].

You must be Logged in to update hint/solution

Discusssion

Login to discuss.


Question analytics