-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path004_arithmatic.py
More file actions
45 lines (28 loc) · 814 Bytes
/
Copy path004_arithmatic.py
File metadata and controls
45 lines (28 loc) · 814 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
39
40
41
42
43
44
45
# Python can do
# addition (+),
# subtraction (-),
# multiplication (*),
# division (/)
print(435 + 567)
print(1000 - 456)
print(23 * 44)
print(857685 / 7676)
# Python can also perform exponentiation.
# print 3 to the power 10
print(3 ** 10)
# Python follow PEMDAS rule
# Parenthesis
# Exponential
# Multiplication / Division (Left to Right)
# Addition / Sunstraction(Left to Right)
print( 23 + (34 + 2) - 2 ** 2 + 37 * 2 - 48 / 5)
# Python offers a companion to the division operator called the modulo operator.
# The modulo operator is indicated by % and gives the remainder of a division calculation.
print(30 % 3)
print(90 % 5)
# Plus-Equal
# if we want to update the value of the variable when we have a number saved in variable
# we can use +=
number = 100
number += 300
print(number)