-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmath_challenge1.py
More file actions
54 lines (34 loc) · 822 Bytes
/
math_challenge1.py
File metadata and controls
54 lines (34 loc) · 822 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
46
47
48
49
# Given a MathOp() function try the following calculations
# 3 / 2
# 3 // 2
# 3 % 2
# 3 ** 2
def MathOp():
division = 3 / 2
floor_division = 3 // 2
modulus = 3 % 2
power = 3**2
return [division, floor_division, modulus, power]
[division, floor_division, modulus, power] = MathOp()
print(division)
print(floor_division)
print(modulus)
print(power)
#Challenge 2
# Given a Challenge() function try the following calculations
# 3 + 2
# 3 - 2
# 3 // 2
# 3 ** 3
def Challenge():
#declare variables
addition = 3 + 2
sub = 3 - 2
floorDivision = 3 // 2
power = 3 ** 3
return [addition, sub,floorDivision, power]
[addition, sub, floorDivision, power] = Challenge()
print('Addition', addition)
print('Sub:', sub)
print('Floor division:', floorDivision)
print('Power:', power)