LearnFrenzy
Sign in Take a free test

List Comprehensions · List Comprehensions MCQ · Question 6

Round brackets around a comprehension Answer, explanation & discussion

  • MCQ
  • Easy
  • 0 comments
  • Answer explained
  • Moderated community
Question 6 Back to Exercise

What is (x * x for x in range(5))?

  • A A generator expression Correct
  • B A tuple of squares
  • C A list of squares
  • D A SyntaxError
Correct Answer: Option A

There is no tuple comprehension; tuple(x * x for x in range(5)) builds a tuple.

Discussion & Comments 0

Share your method, a shortcut, or ask about a step you didn't follow.

No comments yet. Be the first to share your solution!

Post your comment

Comments appear after a quick review by our team.

Search LearnFrenzy

Esc

Quick links