calculator.py
def add(n1, n2):
print(f'덧셈 결과 : {n1+n2}')
def sub(n1, n2):
print(f'뺄셈 결과 : {n1-n2}')
def mul(n1, n2):
print(f'곱셈 결괴 : {n1 * n2}')
def div(n1, n2):
print(f'나눗셈 결괴 : {n1 / n2}')
def reverseStr(str):
reversedString = ''
for c in str:
reversedString = c+ reversedString
return reversedString
import calculator as cal
cal.add(20, 10)
result:
덧셈 결과 : 30
from calculator import add, sub
add(5, 15)
result :
덧셈 결과 : 20
from calculator import *
mul(2, 4)
result :
곱셈 결괴 : 8