A

Admin • 832.27K Points
Coach

Q. How can you generate a list of squares of numbers from 0 to 4?

  • (A) [x**2 for x in range(5)]
  • (B) list(x**2 for x in range(5))
  • (C) Both option1 and option2
  • (D) None of these
  • Correct Answer - Option(C)
  • Views: 19
  • Filed under category Python
  • Hashtags:

Explanation by: Admin

Both list comprehension and generator expression passed to list() will produce the list.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.