-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathoperators.py
More file actions
38 lines (31 loc) · 709 Bytes
/
Copy pathoperators.py
File metadata and controls
38 lines (31 loc) · 709 Bytes
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
# Arithmetic operators-Simple calculations
num1 = 10
num2 = 3
print(num1 + num2)
print(num1 - num2)
print(num1 * num2)
print(num1 / num2)
print(num1 % num2) # Modulus-returns the remainder after division
# Comparison Operators-Compare values
print(num1 < num2)
print(num1 > num2)
print(num1 <= num2)
print(num1 >= num2)
print(num1 == num2) # Equal to
print(num1 != num2) # Not equal to
# Assignment Operator- Assign values to variables
x = 100
print(x)
x += 2
print(x)
y = 56
y -= 3
print(y)
# Logic Operators - and, or, not
a = 23
print(a < 40 and a < 2)
print(not (a < 40 or a < 2))
# Operator Precedence -Order in which operations get executed
result = (10+6/2-4)
print(result)
print(int(result))