Oct-10-2019, 06:31 PM
a = [1,4,9,16,25,36,49,64,81,100] print(list(a[x] for x in range(6)))
gives me [1, 4, 9, 16, 25, 36] whereas
a = [1,4,9,16,25,36,49,64,81,100] print(a[x] for x in range(6))gives me <generator object <genexpr> at 0x030A8BB0>
What exactly is the latter error and why does it occur?