From 2510cfb3dceb0ba4a55dd69bc8aa708c018ff4e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=A5=98=EB=8B=A4=ED=98=84?= Date: Fri, 20 Sep 2024 19:41:13 +0900 Subject: [PATCH] =?UTF-8?q?feat=20:=20=EB=8D=94=ED=95=98=EA=B8=B0=20?= =?UTF-8?q?=EA=B0=9C=EB=B0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- calculator.py | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/calculator.py b/calculator.py index 90f5426..37ad91b 100644 --- a/calculator.py +++ b/calculator.py @@ -1,31 +1,36 @@ def add(a, b): - pass + return a+b def subtract(a, b): - pass - + return a-b def multiply(a, b): - pass + return a*b def divide(a, b): - pass + if b==0: + return "error" + return a/b def pow(a, b): - pass + return a**b def abs(a): - pass - + return a if a>=0 else -a def mod(a, b): - pass - + return a%b if __name__ == "__main__": # 간단한 테스트 코드 - pass \ No newline at end of file + print("Addition:", add(5, 3)) # 8 + print("Subtraction:", subtract(5, 3)) # 2 + print("Multiplication:", multiply(5, 3)) # 15 + print("Division:", divide(5, 0)) # Error: Division by zero + print("Power:", pow(5, 3)) # 125 + print("Absolute:", abs(-5)) # 5 + print("Modulus:", mod(5, 3)) #2 \ No newline at end of file