Adding source code files for Chapter 6

This commit is contained in:
muassif
2021-03-13 19:25:45 +04:00
committed by GitHub
parent e662762d09
commit 9589675a50
45 changed files with 625 additions and 0 deletions
+11
View File
@@ -0,0 +1,11 @@
#dictcomp1.py
dict1 = {'a': 100, 'b': 200, 'c': 300}
dict2 = {x : int(y/2) for (x, y) in dict1.items() if y <=200}
print(dict2)
dict3 = {}
for x,y in dict1.items():
if y <= 200:
dict3[x] = int(y/2)
print(dict3)