@Python_Dv B. x is a generator expression. The values 0,1,2 are each squared giving [0,1,4]. The first print statement consumes the object entirely. Nothing remains in the object for the next print statement, so it is just an empty list. Final output is [0,1,4] [].
Answer: B) [0, 1, 4] and []
Explanation:
x = (i*i for i in range(3)) creates a generator, not a list. Generators produce values only once and don’t store them in memory.
First print(list(x)) → consumes the generator → outputs [0, 1, 4]
Second print(list(x)) → generator is already exhausted → outputs []
This is a key concept: generators are one-time iterables, unlike lists which can be reused multiple times.