File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed
Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change 1+ a = 10
2+ b = 2
3+
4+ print ("Div=" , a / b ) # True Division → always float → 5.0
5+ print ("Div=" , a // b ) # Floor Division → 5
6+
7+ print ("Mul=" , 5 * 2 ) # Multiplication → 10
8+ print ("Square of 2 is=" , 2 ** 2 ) # 2^2 → 4
9+ print ("Cube of 2 is=" , 2 ** 3 ) # 2^3 → 8
10+ print ("3 raised power 4=" , 3 ** 4 ) # 3^4 → 81
11+
12+ """
13+ PEMDAS (Operator Precedence in Python)
14+ P = Parentheses ()
15+ E = Exponent **
16+ M = Multiplication *
17+ D = Division /
18+ F = Floor Division //
19+ Mod = Modulus %
20+ A = Addition +
21+ S = Subtraction -
22+ L-> R
23+ """
24+
25+ expression = 5 + 2 * 3 - 1 + 10 / 5 #5+6-1+2.0->11-1+2.0->10+2.0->12.0
26+ print (expression )
27+
28+ # Calculate BMI
29+ weight = float (input ("Enter weight (kg): " ))
30+ height = float (input ("Enter height (m): " ))
31+
32+ print ("BMI =" , (weight / (height ** 2 )))
33+ print ("BMI =" , round (weight / (height ** 2 ), 1 ))
You can’t perform that action at this time.
0 commit comments