Dictionary Comprehensiond = {}for i in range(1,11): if i % 2 == 0: d[i] = "Even" else: d[i] = "Odd"print(d)d1 = {i: ("Even" if i % 2 == 0 else "Odd") for i in range(1,11)}print(d1)
Post a Comment