
l = [x for x in range(1, 10)]
print(l)

l2 = [x ** 2 for x in range(1, 10)]
print(l2)

l3 = [x for x in range(1, 10) if x % 2 == 0]
print(l3)

tlist = [(x, y) for x in range(1, 3) for y in (5, 7)]
print(tlist)

print(list(range(10)))

matrix = [
    [1, 2, 3, 4],
    [5, 6, 7, 8],
    [9, 10, 11, 12]
]

for x in matrix:
    print(x)
print("-----------")
print ([y for x in matrix for y in x])

l = [x for x in range(1, 10)]
print(l)

l2 = [x ** 2 for x in range(1, 10)]
print(l2)

l3 = [x for x in range(1, 10) if x % 2 == 0]
print(l3)

tlist = [(x, y) for x in range(1, 3) for y in (5, 7)]
print(tlist)

print(list(range(10)))

matrix = [
    [1, 2, 3, 4],
    [5, 6, 7, 8],
    [9, 10, 11, 12]
]

for x in matrix:
    print(x)
print("-----------")
print ([y for x in matrix for y in x])

#Dict

d = {x: y for x in range(3) for y in range(2)}
print(d)

#Set
s = { x + y for y in range(4) for x in range(3)}
print(s)
Add dict and set comprehension demo.
Add dict and set comprehension demo.

  
  l = [x for x in range(1, 10)]
  print(l)
  
  l2 = [x ** 2 for x in range(1, 10)]
  print(l2)
  
  l3 = [x for x in range(1, 10) if x % 2 == 0]
  print(l3)
  
  tlist = [(x, y) for x in range(1, 3) for y in (5, 7)]
  print(tlist)
  
  print(list(range(10)))
  
  matrix = [
      [1, 2, 3, 4],
      [5, 6, 7, 8],
      [9, 10, 11, 12]
  ]
  
  for x in matrix:
      print(x)
  print("-----------")
  print ([y for x in matrix for y in x])
+ 
+ #Dict
+ 
+ d = {x: y for x in range(3) for y in range(2)}
+ print(d)
+ 
+ #Set
+ s = { x + y for y in range(4) for x in range(3)}
+ print(s)
Add dict and set comprehension demo.
## Code Before:

l = [x for x in range(1, 10)]
print(l)

l2 = [x ** 2 for x in range(1, 10)]
print(l2)

l3 = [x for x in range(1, 10) if x % 2 == 0]
print(l3)

tlist = [(x, y) for x in range(1, 3) for y in (5, 7)]
print(tlist)

print(list(range(10)))

matrix = [
    [1, 2, 3, 4],
    [5, 6, 7, 8],
    [9, 10, 11, 12]
]

for x in matrix:
    print(x)
print("-----------")
print ([y for x in matrix for y in x])
## Instruction:
Add dict and set comprehension demo.
## Code After:

l = [x for x in range(1, 10)]
print(l)

l2 = [x ** 2 for x in range(1, 10)]
print(l2)

l3 = [x for x in range(1, 10) if x % 2 == 0]
print(l3)

tlist = [(x, y) for x in range(1, 3) for y in (5, 7)]
print(tlist)

print(list(range(10)))

matrix = [
    [1, 2, 3, 4],
    [5, 6, 7, 8],
    [9, 10, 11, 12]
]

for x in matrix:
    print(x)
print("-----------")
print ([y for x in matrix for y in x])

#Dict

d = {x: y for x in range(3) for y in range(2)}
print(d)

#Set
s = { x + y for y in range(4) for x in range(3)}
print(s)