In [1]:
l = [i**2 for i in range(5)]
In [2]:
print(l)
In [3]:
print(type(l))
In [4]:
g = (i**2 for i in range(5))
In [5]:
print(g)
In [6]:
print(type(g))
In [7]:
for i in g:
print(i)
In [8]:
g_cells = ((row, col) for row in range(0, 3)
for col in range(0, 2) if col == row)
In [9]:
print(type(g_cells))
In [10]:
for i in g_cells:
print(i)
In [11]:
print(sum([i**2 for i in range(5)]))
In [12]:
print(sum((i**2 for i in range(5))))
In [13]:
print(sum(i**2 for i in range(5)))
In [14]:
t = tuple(i**2 for i in range(5))
In [15]:
print(t)
In [16]:
print(type(t))