프로그래밍 공부/파이선_정보취합하기
7가지 연산자를 이용한 계산 실습
쫑가
2021. 5. 17. 20:26
https://docs.python.org/3/library/stdtypes.html#numeric-types-int-float-complex
Built-in Types — Python 3.9.5 documentation
The following sections describe the standard types that are built into the interpreter. The principal built-in types are numerics, sequences, mappings, classes, instances and exceptions. Some collection classes are mutable. The methods that add, subtract,
docs.python.org
- plus,
- minus,
- times,
- division,
- negation,
- power,
- reminder
def plus(a,b):
return(int(a) + int(b))
def minus(a,b):
return(int(a) - int(b))
def times(a,b):
return(int(a) * int(b))
def division(a,b):
return(int(a) / int(b))
def negation(a):
return(-int(a))
def power(a,b):
return(int(a) ** int(b))
def remainder(a,b):
return(int(a) % int(b))
print(plus(1,"2"))
print(minus("3",4))
print(times("5",6))
print(division("7","8"))
print(negation("9"))
print(power("10",11))
print(remainder("13","12"))
---------------------------
3
-1
30
0.875
-9
10