Skip to content

Commit 6dff643

Browse files
Add summary table for Python data types
Added a summary table of Python data types with descriptions and a tip for checking data types.
1 parent d0cf238 commit 6dff643

File tree

1 file changed

+27
-1
lines changed

1 file changed

+27
-1
lines changed

basics/variables_and_data_types.py

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,4 +316,30 @@
316316
print(f"Words: {words}")
317317

318318
print("\n=== End of Tutorial ===")
319-
print("Practice tip: Try modifying the values and see how the results change!")
319+
print("Practice tip: Try modifying the values and see how the results change!")
320+
321+
# =============================================================================
322+
# 11. SUMMARY TABLE OF PYTHON DATA TYPES
323+
# =============================================================================
324+
325+
print("--- Summary of Python Data Types ---\n")
326+
327+
data_types_summary = [
328+
("int", "Whole numbers (e.g., 5, -10, 2025)"),
329+
("float", "Decimal numbers (e.g., 3.14, -2.5)"),
330+
("complex", "Numbers with real and imaginary parts (e.g., 2 + 3j)"),
331+
("str", "Sequence of characters (e.g., 'Hello')"),
332+
("bool", "Boolean values True or False"),
333+
("list", "Ordered, mutable collection (e.g., [1, 2, 3])"),
334+
("tuple", "Ordered, immutable collection (e.g., (1, 2, 3))"),
335+
("dict", "Key-value pairs (e.g., {'name': 'Alice', 'age': 25})"),
336+
("set", "Unordered collection of unique elements (e.g., {1, 2, 3})"),
337+
]
338+
339+
print(f"{'Data Type':<10} | Description")
340+
print("-" * 50)
341+
for dtype, desc in data_types_summary:
342+
print(f"{dtype:<10} | {desc}")
343+
344+
print("\n💡 Tip: Use the 'type()' function to check any variable’s data type!")
345+
print("\n=== End of Extended Tutorial ===")

0 commit comments

Comments
 (0)