We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent aeb2e79 commit 65ad34cCopy full SHA for 65ad34c
dictonary/Dict_Comprehensions2.py
@@ -0,0 +1,11 @@
1
+person={
2
+ "name":"kuchbhi",
3
+ "age":30,
4
+ "city":"new yerk"
5
+}
6
+
7
+squares = {x: x*x for x in range(6)}
8
9
+# Dictionary comprehension with a condition
10
+even_squares = {x: x*x for x in range(10) if x % 2 == 0}
11
+print(even_squares) # Output: {0: 0, 2: 4, 4: 16, 6: 36, 8: 64}
0 commit comments