File tree 4 files changed +37
-0
lines changed
4 files changed +37
-0
lines changed Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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 )} " )
Original file line number Diff line number Diff line change
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 )
Original file line number Diff line number Diff line change
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 )
You can’t perform that action at this time.
0 commit comments