-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patharithmetic_function.py
More file actions
121 lines (95 loc) · 2.52 KB
/
arithmetic_function.py
File metadata and controls
121 lines (95 loc) · 2.52 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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
def addition(a, b):
# '''
# Input:
# -a: 실수 값 (Integer or float)
# -b: 실수 값 (Integer or float)
# Output:
# -두 값의 합
# Examples:
# >>> addition(3,5)
# 8
# >>> addition(3,2)
#
# '''
# pass
# ===Modify codes below=============
result = a + b
# ==================================
return result
def minus(a, b):
# '''
# Input:
# -a: 실수 값 (Integer or float)
# -b: 실수 값 (Integer or float)
# Output:
# -두 값의 차
# Examples:
# >>> minus(3,5)
# -2
# >>> minus(3,2)
# 1
# '''
# pass
# ===Modify codes below=============
result = a-b
# ==================================
return result
def multiplication(a, b):
# '''
# Input:
# -a: 실수 값 (Integer or float)
# -b: 실수 값 (Integer or float)
# Output:
# -두 값의 곱
# Examples:
# >>> multiplication(3,5.1)
# 15.3
# >>> multiplication(3,2)
# 6
# '''
# pass
# ===Modify codes below=============
result = a*b
# ==================================
return result
def division(a, b):
# '''
# Input:
# -a: 실수 값 (Integer or float)
# -b: 실수 값 (Integer or float)
# Output:
# -a를 b로 나눈 값
# Examples:
# >>> division(5,5)
# 1
# >>> division(4,2)
# 2
# '''
# pass
# ===Modify codes below=============
result = a/b
# ==================================
return result
def main():
print ("Addition Test")
print (addition(3,5)) # Expected Result: 8
print (addition(10,5) == 15) # Expected Result: True
print ("Addition Test Closed \n")
print ("Minus Test")
print (minus(3,5)) # Expected Result: -2
print (minus(10,5) == 5) # Expected Result: True
print (minus(10,15) == 5) # Expected Result: False
print ("Addition Test Closed \n")
print ("Multiplication Test")
print (multiplication(3,5)) # Expected Result: 15
print (multiplication(10,5) == 50) # Expected Result: True
print (multiplication(10,-3) == 20) # Expected Result: False
print ("Addition Test Closed \n")
print ("division Test")
print (division(5,5)) # Expected Result: 1
print (division(5,4)) # Expected Result: 1.25
print (division(10,5) == 2) # Expected Result: True
print (division(10,-3) == 0.33333) # Expected Result: False
print ("division Test Closed \n")
if __name__ == "__main__":
main()