Python Comprehensions
#List Comprehensions list = [i for i in range( 100 ) if i % 4 == 0 ] print(list) # Dictionary Comprehensions dict1 = {i: f"Item { i } " for i in range( 10 ) if i % 2 == 0 } dict2 = {value:key for key,value in dict1.items()} print(dict1) print(dict2) #Set Comprehensions dresses = {dress for dress in [ "dress1" , "dress2" , "dress1" , "dress2" , "dress1" , "dress2" ]} print(dresses) #Generator Comprehensions gen = (i for i in range( 100 ) if i % 5 == 0 ) print(type(gen)) print(gen) print(gen.__next__()) print(gen.__next__()) print(gen.__next__()) print(gen.__next__()) # # for i in gen: # print(i)