Post

Jimmy Fikes
Jimmy Fikes@akajim·
@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] [].
English
0
0
2
168
The Powerful Man
The Powerful Man@_ThePowerfulMan·
Want to know if your marriage is too late to save? We've helped thousands of men just like you. Don't let inaction keep you from the life you deserve.
English
0
0
0
519
Kamal Gurjar
Kamal Gurjar@KamalGurjar8·
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.
English
0
1
8
219
Paylaş