forked from github/dev
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path06_Math.py
More file actions
62 lines (48 loc) · 1.03 KB
/
06_Math.py
File metadata and controls
62 lines (48 loc) · 1.03 KB
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
friends = 5
#ADDITION
friends = friends + 1
print(friends)
#auguemented assignment operator
friends += 1
print(friends)
#SUBTRACTION
friends = friends -2
print(friends)
#auguemented assignment operator
friends -= 2
print(friends)
#MULTIPLICATION
friends = friends * 3
print(friends)
#auguemented assignment operator
friends *= 3
print(friends)
#DEVISION
friends = friends / 2
print(friends)
#auguemented assignment operator
friends /= 2
print(friends)
#EXPONENT
friends = friends ** 2
print(friends)
#auguemented assignment operator
friends **=2
print(friends)
#REMAINDER - Modulus operator
remainder = friends % 3
print(remainder)
#----------------------------------------------
x=3.14
y=-4
z=5
result = round(x) #rounds to the nearest whole number
print(result)
result = abs(y) #returns the absolute value of y
print(result)
result = pow(y,3) #returns y raised to the power of 3
print(result)
result = (x,y,z) #returns the largest number
print(result)
result = min(x,y,z) #returns the smallest number
print(result)