Skip to content

Commit ff68713

Browse files
committed
Day 2 - Data Types
1 parent f6840e8 commit ff68713

File tree

4 files changed

+37
-0
lines changed

4 files changed

+37
-0
lines changed

Day 2 - Data Types/README.md

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Day 2: Data Types and Operations
2+
3+
## Concepts:
4+
- Fundamental data types
5+
- Arithmetic operations
6+
- Type conversion
7+
8+
## Exercises:
9+
1. Create a BMI calculator (weight/height²)
10+
2. Make a string reverser

Day 2 - Data Types/data_types.py

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Numeric types
2+
integer_num = 10
3+
float_num = 3.14
4+
5+
# Sequence types
6+
my_string = "Python"
7+
my_list = [1, 2, 3]
8+
9+
# Boolean
10+
is_true = True
11+
12+
print(f"Type of integer_num: {type(integer_num)}")

Day 2 - Data Types/operations.py

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Arithmetic
2+
print(5 + 3)
3+
print(10 - 2.5)
4+
print(2 ** 4) # Exponentiation
5+
6+
# String operations
7+
greeting = "Hello" + " " + "World!"
8+
print(greeting)

Day 2 - Data Types/type_conversion.py

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Implicit conversion
2+
print(3 + 2.5) # int + float = float
3+
4+
# Explicit conversion
5+
num_str = "123"
6+
num_int = int(num_str)
7+
print(num_int * 2)

0 commit comments

Comments
 (0)