-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprecedence.py
40 lines (29 loc) · 831 Bytes
/
precedence.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# Victoria
a = 10
b = 5
c = 2
d = 1
e = 8
f = False
# BIDMAS BODMAS
# Brackets Indices Division Multiplication Addition Subtraction
# PEMDAS - Parentheses Exponent Mult Div Add Subtract
calculation_result = a + b - c * d / e
print(calculation_result)
calculation_result = (a + b) - c * d / e
print(calculation_result)
calculation_result = a + (b - c) * d / e
print(calculation_result)
calculation_result = (a + (b - c)) * d / e
print(calculation_result)
calculation_result = (a + (b - c)) * (d / e)
print(calculation_result)
calculation_result = (a + b - c * d) / e
print(calculation_result)
print("~" * 60)
if a < 20 and b > 1 and not f:
print("a is less than 20 and b is greater than 1 and f is False")
if not f and c == 2:
print('f is False and c is 2')
if c == 2 and not f:
print('f is False and c is 2')