티스토리 뷰
0. 연산자(Operators)
연산자는 변수 및 값에 대한 수정 변환 작업의 할때 사용한다.
파이썬에서 연산자는 아래와 같은 유형으로 나눌 수 있다.
- 산술 연산자(Arithmetic Operators)
- 할당 연산자(Assignment Operators)
- 비교 연산자(Comparison Operators)
- 논리 연산자(Logical Operators)
- 아이덴티 연산자(Identity Operators)
- 멤버쉽 연산자(Membership Operators)
- 비트와이즈 연산자(Bitwise Operators)
1. 산술 연산자(Atithmetic Operators)
산술 연산자는 일반적인 수학 연산을 수행하기 위해 숫자와 함께 사용한다.
Operator | Name | 설명 | Example |
+ | Addition | 연산자의 양쪽 값을 더한 값을 구한다. | x + y |
- | Subtaction | 연산자의 왼쪽 값에서 오른쪽 값을 뺀 값을 구한다. | x - y |
* | Multiplication | 연산자의 양쪽 값을 곱한 값을 구한다. | x * y |
/ | Division | 연산자의 왼쪽 값에서 오른쪽 값을 나눈 값을 구한다. | x / y |
% | Modulus | 연산자의 왼쪽 값에서 오른쪽 값을 나눈 나머지를 구한다. | x % y |
** | Exponentiation | 연산자의 왼쪽 값에 오른쪽 값을 승수한 값을 구한다. | x ** y |
// | Floor division | 연산자의 왼쪽 값에 오른쪽 값을 나눈 정수부의 값을 구한다. | x // y |
1) 산술 연산자 예제
# 05_01_00_PythonArthmeticOperators
# 기본 할당 방법
FirstValue = 3
SecondValue = 2
# 덧셈 연산
print(FirstValue + SecondValue) # 5
print(FirstValue) # 3
print(SecondValue) # 2
# 뺄셈 연산
print(FirstValue - SecondValue) # 1
print(FirstValue) # 3
print(SecondValue) # 2
# 곱셈 연산
print(FirstValue * SecondValue) # 6
print(FirstValue) # 3
print(SecondValue) # 2
# 나눗셈 연산
print(FirstValue / SecondValue) # 1.5
print(FirstValue) # 3
print(SecondValue) # 2
# 나머지 연산
modValue = FirstValue % SecondValue
print(modValue) # 1
print(FirstValue) # 3
print(SecondValue) # 2
# 몫 연산
floorValue = FirstValue // SecondValue
print(modValue) # 1
print(FirstValue) # 3
print(SecondValue) # 2
# 승수 연산
expValue = FirstValue ** SecondValue
print(expValue) # 9
print(FirstValue) # 3
print(SecondValue) # 2
2. 할당 연산자(Assignment Operators)
할당 연산자는 변수에 값을 대입할 때 사용한다.
Operator | 설명 | Example |
= | 연산자의 오른쪽 값을 왼쪽에 할당한다. | x = y |
+= | 연산자의 왼쪽 값과 오른쪽 값을 더하여 왼쪽에 할당한다. | x += y |
-= | 연산자의 왼쪽 값에서 오른쪽 값을 뺀 값을 왼쪽에 할당한다. | x -= y |
*= | 연산자의 왼쪽 값에서 오른쪽 값을 곱한 값을 왼쪽에 할당한다. | x *= y |
/= | 연산자의 왼쪽 값에서 오른쪽 값을 나눈 값을 왼쪽에 할당한다. | x /= y |
%= | 연산자의 왼쪽 값에서 오른쪽 값을 나눈 값의 나머지를 왼쪽에 할당한다. | x %= y |
**= | 연산자의 왼쪽 값에서 오른쪽 값을 승수한 값을 왼쪽에 할당한다. | x **= y |
//= | 연산자의 왼쪽 값에서 오른쪽 값을 나눈 정수부의 값을 왼쪽에 할당한다. | x //= y |
&= | 연산자의 왼쪽 값에서 오른쪽 값을 비트 논리곱 한 값을 왼쪽에 할당한다. | x &= y |
|= | 연산자의 왼쪽 값에서 오른쪽 값을 비트 논리합 한 값을 왼쪽에 할당한다. | x != y |
^= | 연산자의 왼쪽 값에서 오른쪽 값을 비트 배타적 논리곱 한 값을 왼쪽에 할당한다. | x ^= y |
>>= | 연산자의 왼쪽 값을 오른쪽 값의 자리만큼 왼쪽으로 이동하고 0을 채운값을 할당한다. | x >>= y |
<<= | 연산자의 왼쪽 값을 오른쪽 값의 자리만큼 오른쪽으로 이동하고 0을 채운값을 할당한다. | x <<= y |
# 05_02_00_PythonAssignmentOperators
# = 할당 연산자
FirstValue = 3
SecondValue = 2
FirstValue = SecondValue
print(FirstValue) # 2
print(SecondValue) # 2
# += 할당 연산자
FirstValue = 3
SecondValue = 2
FirstValue += SecondValue
print(FirstValue) # 5
print(SecondValue) # 2
# -= 할당 연산자
FirstValue = 3
SecondValue = 2
FirstValue -= SecondValue
print(FirstValue) # 1
print(SecondValue) # 2
# *= 할당 연산자
FirstValue = 3
SecondValue = 2
FirstValue *= SecondValue
print(FirstValue) # 6
print(SecondValue) # 2
# /= 할당 연산자
FirstValue = 3
SecondValue = 2
FirstValue /= SecondValue
print(FirstValue) # 1.5
print(SecondValue) # 2
# %= 할당 연산자
FirstValue = 3
SecondValue = 2
FirstValue %= SecondValue
print(FirstValue) # 1
print(SecondValue) # 2
# //= 할당 연산자
FirstValue = 3
SecondValue = 2
FirstValue //= SecondValue
print(FirstValue) # 1
print(SecondValue) # 2
# **= 할당 연산자
FirstValue = 3
SecondValue = 2
FirstValue **= SecondValue
print(FirstValue) # 9
print(SecondValue) # 2
# &= 할당 연산자
FirstValue = 3
SecondValue = 2
FirstValue &= SecondValue
print(FirstValue) # 2
print(SecondValue) # 2
# |= 할당 연산자
FirstValue = 3
SecondValue = 2
FirstValue |= SecondValue
print(FirstValue) # 3
print(SecondValue) # 2
# ^= 할당 연산자
FirstValue = 3
SecondValue = 2
FirstValue ^= SecondValue
print(FirstValue) # 1
print(SecondValue) # 2
# >>= 할당 연산자
FirstValue = 3
SecondValue = 2
FirstValue >>= SecondValue
print(FirstValue) # 0
print(SecondValue) # 2
# <<= 할당 연산자
FirstValue = 3
SecondValue = 2
FirstValue <<= SecondValue
print(FirstValue) # 12
print(SecondValue) # 2
3. 비교 연산자(Comparison Operators)
비교 연산자는 두 값을 비교하는 데 사용한다.
Operator | 설명 | Example |
== | 연산자의 왼 값과 오른쪽 값이 같으면 참을 반환한다. | x == y |
!= | 연산자의 왼쪽 값과 오른쪽 값이 다르면 참을 반환한다. | x != y |
> | 연산자의 왼쪽 값이 오른쪽 값 보다 클 경우 참을 반환한다. | x > y |
< | 연산자의 왼쪽 값이 오른쪽 값 보다 작을 경우 참을 반환한다. | x < y |
>= | 연산자의 왼쪽 값이 오른쪽 값 보다 크거나 같을 경우 참을 반환한다. | x >= y |
<= | 연산자의 왼쪽 값이 오른쪽 값 보다 작거나 같을 경우 참을 반환한다. | x <= y |
# 05_03_00_PythonComparisonOperators
xZero = 0
xNotZero = 1
yZero = 0
yNotZero = 1
# 부울 값 검증
print(xZero == True) # False
print(xZero == False) # True
print(xNotZero == True) # True
print(xNotZero == False) # False
# == 연산자
print(xZero == yZero) # True
print(xZero == yNotZero) # False
print(xNotZero == yZero) # False
print(xNotZero == yNotZero) # True
# != 연산자
print(xZero != yZero) # False
print(xZero != yNotZero) # True
print(xNotZero != yZero) # True
print(xNotZero != yNotZero) # False
# > 연산자
print(xZero > yZero) # False
print(xZero > yNotZero) # False
print(xNotZero > yZero) # True
print(xNotZero > yNotZero) # False
# < 연산자
print(xZero < yZero) # False
print(xZero < yNotZero) # True
print(xNotZero < yZero) # False
print(xNotZero < yNotZero) # False
# >= 연산자
print(xZero >= yZero) # True
print(xZero >= yNotZero) # False
print(xNotZero >= yZero) # True
print(xNotZero >= yNotZero) # True
# <= 연산자
print(xZero <= yZero) # True
print(xZero <= yNotZero) # True
print(xNotZero <= yZero) # False
print(xNotZero <= yNotZero) # True
4. 논리 연산자(Logical Operators)
논리 연산자는 조건문을 결합 할때 사용한다.
Operator | 설명 | Example |
and | 연산자의 왼쪽 값과 오른쪽 값이 모두 참이면 참을 반환한다. | x and y |
or | 연산자의 왼쪽 값과 오른쪽 값중에 하나라도 참이면 참을 반환한다. | x or y |
not | 값이 참일 경우 거짓을 거짓일 경우 참을 반환한다. | not(x) |
# 05_04_00_PythonLogicalOperators
xZero = 0
xNotZero = 1
yTrue = True
yFalse = False
# 부울 값 확인
print(xZero) # 0
print(xNotZero) # 1
print(yTrue) # True
print(yFalse) # False
# And Operators
print(xZero and xZero) # 0
print(xZero and xNotZero) # 0
print(xZero and yTrue) # 0
print(xZero and yFalse) # 0
print(xNotZero and xZero) # 0
print(xNotZero and xNotZero) # 1
print(xNotZero and yTrue) # True
print(xNotZero and yFalse) # False
print(yTrue and xZero) # 0
print(yTrue and xNotZero) # 1
print(yTrue and yTrue) # True
print(yTrue and yFalse) # False
print(yFalse and xZero) # False
print(yFalse and xNotZero) # False
print(yFalse and yTrue) # False
print(yFalse and yFalse) # False
# Or Operators
print(xZero or xZero) # 0
print(xZero or xNotZero) # 1
print(xZero or yTrue) # True
print(xZero or yFalse) # False
print(xNotZero or xZero) # 1
print(xNotZero or xNotZero) # 1
print(xNotZero or yTrue) # 1
print(xNotZero or yFalse) # 1
print(yTrue or xZero) # True
print(yTrue or xNotZero) # True
print(yTrue or yTrue) # True
print(yTrue or yFalse) # True
print(yFalse or xZero) # 0
print(yFalse or xNotZero) # 1
print(yFalse or yTrue) # True
print(yFalse or yFalse) # False
# Not Operators
print(not xZero) # True
print(not xNotZero) # False
print(not yTrue) # False
print(not yFalse) # True
5. 아이덴티 연산자(Identiry Operators)
아이덴티 연산자는 두 객체가 동일한 객체 인지를 비교한다.
Operator | 설명 | Example |
is | 두 값이 동일한 객체일 경우 참을 반환한다. | x is y |
is not | 두 값이 동일한 객체가 아닐 경우 참을 반환한다. | x is not y |
# 05_05_00_PythonIdentityOperators
FirstIdentity = 10
SecondIdentity = 10
ThiredIdentity = 10.0
print(id(FirstIdentity)) # 140720180926400
print(id(SecondIdentity)) # 140720180926400
print(id(ThiredIdentity)) # 3028251405232
print(FirstIdentity is SecondIdentity) # True
print(id(FirstIdentity) == id(SecondIdentity)) # True
SecondIdentity = 20
print(FirstIdentity is SecondIdentity) # False
print(id(FirstIdentity) == id(SecondIdentity)) # False
print(FirstIdentity is not SecondIdentity) # True
print(id(FirstIdentity) != id(SecondIdentity)) # True
6. 멤버쉽 연산자(Membership Operators)
멤버쉽 연산자는 스퀀스 데이터 유형의 아이템이 존재하는지를 비교하는데 사용한다.
주의 할 것은 멤버자체를 하나의 객체로 인식하는 부분을 주의 해야 한다.
Operator | 설명 | Example |
in | 동일한 아이템을 찾을 경우 참을 반환한다. | x in y |
not in | 동일한 아이템을 찾지 못할 경우 참을 반환한다. | x not in y |
# 05_06_00_PythonMembershipOperators
FirstMember = 10
SecondMember = 20
list = [10, 11]
lists = [10, 11, 12, 13, 14]
listx = [[10, 11], 12, 13, 14]
sets = (10, 11, 12, 13, 14)
# List Type 에서도 작동함
print(FirstMember in lists) # True
print(FirstMember not in lists) # False
print(SecondMember in lists) # False
print(SecondMember not in lists) # True
# Set Type 에서도 작동함
print(FirstMember in sets) # True
print(FirstMember not in sets) # False
print(SecondMember in sets) # False
print(SecondMember not in sets) # True
# List 객체에 대해서는 비교 불가
print(list in lists) # False
print(list not in lists) # True
print(list in listx) # True
print(list not in listx) # False
7. 비트와이즈 연산자(Bitwise Operators)
비트 연산자는 이진수 숫자를 비교하는데 사용한다.
음수 값의 비트를 연산할 경우 계산패턴이 특이한 경우를 보임
(2의 보수와 연관이 있는것으로 생각되나 추가 연구가 필요함)
Operator | Name | 설명 | Example |
& | AND | 비트 논리 곱을 반환한다. | x & y |
| | OR | 비트 논리 합을 반환한다. | x | y |
^ | XOR | 배타적 논리 합을 반환한다. | x ^ y |
~ | NOT | 2진수 부호로 2의 보수를 반환한다. | ~x |
<< | Zero fill left shift | 왼쪽 값을 오른쪽 값만큼 비트를 왼쪽으로 이동한다. | x << y |
>> | Signed right shift | 왼쪽 값을 오른쪽 값만큼 비트를 오른쪽으로 이동한다. | x >> y |
- Bitwise AND 논리표
X | Y | 진리값 |
0 | 0 | 0 |
1 | 0 | 0 |
0 | 1 | 0 |
1 | 1 | 1 |
- Bitwise OR 논리표
X | Y | 진리값 |
0 | 0 | 0 |
1 | 0 | 1 |
0 | 1 | 1 |
1 | 1 | 1 |
- Bitwise XOR 논리표
X | Y | 진리값 |
0 | 0 | 0 |
1 | 0 | 1 |
0 | 1 | 1 |
1 | 1 | 0 |
- NOT 연산자의 경우
연산 값이 양수 인 N일 경우 연산된 값은 -|N+1| 로 계산된다.
연산 값이 음수 인 -N일 경우 연산된 값은 |N-1|로 계산된다.
# 05_07_00_PythonBitwiseOperators
bitPositive10 = 10
bitPositiveOne = 1
bitZero = 0
bitNegativeOne = -1
bitNegative10 = -10
# Bitwise Output
print(type(bitPositive10)) # <class 'int'>
bitString = bin(bitPositive10)
print(type(bin(bitPositive10))) # <class 'str'>
print(bin(bitPositive10)) # 0b1010
print('{0:b}'.format(bitPositive10).zfill(8)) # 00001010
print('{0:b}'.format(bitPositiveOne).zfill(8)) # 00000001
print('{0:b}'.format(bitZero).zfill(8)) # 00000000
print('{0:b}'.format(bitNegativeOne).zfill(8)) # -0000001
print('{0:b}'.format(bitNegative10).zfill(8)) # -0001010
# Bitwise AND Operator
print('{0:b}'.format(bitZero & bitZero).zfill(8)) # 00000000
print('{0:b}'.format(bitPositiveOne & bitZero).zfill(8)) # 00000000
print('{0:b}'.format(bitZero & bitPositiveOne).zfill(8)) # 00000000
print('{0:b}'.format(bitPositiveOne & bitPositiveOne).zfill(8)) # 00000001
print('{0:b}'.format(bitZero & bitPositive10).zfill(8)) # 00000000
print('{0:b}'.format(bitPositive10 & bitZero).zfill(8)) # 00000000
print('{0:b}'.format(bitPositive10 & bitPositive10).zfill(8)) # 00001010
# 음수 기호도 동일하게 AND 조건이 적용됨
print('{0:b}'.format(bitNegativeOne & bitZero).zfill(8)) # 00000000
print('{0:b}'.format(bitZero & bitNegativeOne).zfill(8)) # 00000000
print('{0:b}'.format(bitNegativeOne & bitNegativeOne).zfill(8)) # -0000001
print('{0:b}'.format(bitZero & bitNegative10).zfill(8)) # 00000000
print('{0:b}'.format(bitNegative10 & bitZero).zfill(8)) # 00000000
print('{0:b}'.format(bitNegative10 & bitNegative10).zfill(8)) # -0001010
# 음수 기호가 큰 값일 경우 위 패턴과 상이한 결과를 보임(2의 보수?)
print('{0:b}'.format(bitPositive10 & bitNegative10).zfill(8)) # 00000010
print('{0:b}'.format(bitNegative10 & bitPositive10).zfill(8)) # 00000010
bit20 = 20
bit20n = -20
print('{0:b}'.format(bit20).zfill(8)) # 00010100
print('{0:b}'.format(bit20n).zfill(8)) # -0010100
print('{0:b}'.format(bit20 & bit20n).zfill(8)) # 00000100
# Bitwise OR Operator
print();
print('{0:b}'.format(bitZero | bitZero).zfill(8)) # 00000000
print('{0:b}'.format(bitPositiveOne | bitZero).zfill(8)) # 00000001
print('{0:b}'.format(bitZero | bitPositiveOne).zfill(8)) # 00000001
print('{0:b}'.format(bitPositiveOne | bitPositiveOne).zfill(8)) # 00000001
print('{0:b}'.format(bitZero | bitPositive10).zfill(8)) # 00001010
print('{0:b}'.format(bitPositive10 | bitZero).zfill(8)) # 00001010
print('{0:b}'.format(bitPositive10 | bitPositive10).zfill(8)) # 00001010
# 음수 기호도 동일하게 OR 조건이 적용됨
print('{0:b}'.format(bitNegativeOne | bitZero).zfill(8)) # -0000001
print('{0:b}'.format(bitZero | bitNegativeOne).zfill(8)) # -0000001
print('{0:b}'.format(bitNegativeOne | bitNegativeOne).zfill(8)) # -0000001
print('{0:b}'.format(bitZero | bitNegative10).zfill(8)) # -0001010
print('{0:b}'.format(bitNegative10 | bitZero).zfill(8)) # -0001010
print('{0:b}'.format(bitNegative10 | bitNegative10).zfill(8)) # -0001010
# 음수 기호가 큰 값일 경우 위 패턴과 상이한 결과를 보임(2의 보수?)
print('{0:b}'.format(bitPositive10 | bitNegative10).zfill(8)) # -0000010
print('{0:b}'.format(bitNegative10 | bitPositive10).zfill(8)) # -0000010
bit20 = 20
bit20n = -20
print('{0:b}'.format(bit20).zfill(8)) # 00010100
print('{0:b}'.format(bit20n).zfill(8)) # -0010100
print('{0:b}'.format(bit20 | bit20n).zfill(8)) # -0000100
# Bitwise XOR Operator
print();
print('{0:b}'.format(bitZero ^ bitZero).zfill(8)) # 00000000
print('{0:b}'.format(bitPositiveOne ^ bitZero).zfill(8)) # 00000001
print('{0:b}'.format(bitZero ^ bitPositiveOne).zfill(8)) # 00000001
print('{0:b}'.format(bitPositiveOne ^ bitPositiveOne).zfill(8)) # 00000000
print('{0:b}'.format(bitZero ^ bitPositive10).zfill(8)) # 00001010
print('{0:b}'.format(bitPositive10 ^ bitZero).zfill(8)) # 00001010
print('{0:b}'.format(bitPositive10 ^ bitPositive10).zfill(8)) # 00000000
# 음수 기호도 동일하게 OR 조건이 적용됨
print('{0:b}'.format(bitNegativeOne ^ bitZero).zfill(8)) # -0000001
print('{0:b}'.format(bitZero ^ bitNegativeOne).zfill(8)) # -0000001
print('{0:b}'.format(bitNegativeOne ^ bitNegativeOne).zfill(8)) # -0000000
print('{0:b}'.format(bitZero ^ bitNegative10).zfill(8)) # -0001010
print('{0:b}'.format(bitNegative10 ^ bitZero).zfill(8)) # -0001010
print('{0:b}'.format(bitNegative10 ^ bitNegative10).zfill(8)) # -0000000
# 음수 기호가 큰 값일 경우 위 패턴과 상이한 결과를 보임(2의 보수 ?)
print('{0:b}'.format(bitPositive10 ^ bitNegative10).zfill(8)) # -0000100
print('{0:b}'.format(bitNegative10 ^ bitPositive10).zfill(8)) # -0000100
bit20 = 20
bit20n = -20
print('{0:b}'.format(bit20).zfill(8)) # 00010100
print('{0:b}'.format(bit20n).zfill(8)) # -0010100
print('{0:b}'.format(bit20 ^ bit20n).zfill(8)) # -0001000
# Bitwise XOR Operator
print();
print('{0:b}'.format(bitZero ^ bitZero).zfill(8)) # 00000000
print('{0:b}'.format(bitPositiveOne ^ bitZero).zfill(8)) # 00000001
print('{0:b}'.format(bitZero ^ bitPositiveOne).zfill(8)) # 00000001
print('{0:b}'.format(bitPositiveOne ^ bitPositiveOne).zfill(8)) # 00000000
print('{0:b}'.format(bitZero ^ bitPositive10).zfill(8)) # 00001010
print('{0:b}'.format(bitPositive10 ^ bitZero).zfill(8)) # 00001010
print('{0:b}'.format(bitPositive10 ^ bitPositive10).zfill(8)) # 00000000
# 음수 기호도 동일하게 OR 조건이 적용됨
print('{0:b}'.format(bitNegativeOne ^ bitZero).zfill(8)) # -0000001
print('{0:b}'.format(bitZero ^ bitNegativeOne).zfill(8)) # -0000001
print('{0:b}'.format(bitNegativeOne ^ bitNegativeOne).zfill(8)) # -0000000
print('{0:b}'.format(bitZero ^ bitNegative10).zfill(8)) # -0001010
print('{0:b}'.format(bitNegative10 ^ bitZero).zfill(8)) # -0001010
print('{0:b}'.format(bitNegative10 ^ bitNegative10).zfill(8)) # -0000000
# 음수 기호가 큰 값일 경우 위 패턴과 상이한 결과를 보임(2의 보수 ?)
print('{0:b}'.format(bitPositive10 ^ bitNegative10).zfill(8)) # -0000100
print('{0:b}'.format(bitNegative10 ^ bitPositive10).zfill(8)) # -0000100
bit20 = 20
bit20n = -20
print('{0:b}'.format(bit20).zfill(8)) # 00010100
print('{0:b}'.format(bit20n).zfill(8)) # -0010100
print('{0:b}'.format(bit20 ^ bit20n).zfill(8)) # -0001000
# Bitwise NOT Operator
print();
print('{0:b}'.format(~bitZero).zfill(8)) # -0000001
print('{0:b}'.format(~bitPositiveOne).zfill(8)) # -0000010
print('{0:b}'.format(~bitPositive10).zfill(8)) # -0001011
print('{0:b}'.format(~bitNegativeOne).zfill(8)) # 00000000
print('{0:b}'.format(~bitNegative10).zfill(8)) # 00001001
# Bitwise Left Shift Operator
print();
print('{0:b}'.format(bitZero << 2).zfill(8)) # 00000000
print('{0:b}'.format(bitPositiveOne << 2).zfill(8)) # 00000100
print('{0:b}'.format(bitPositive10 << 2).zfill(8)) # 00101000
# 음수 기호는 부호자리는 영향을 주지 않음
print('{0:b}'.format(bitNegativeOne << 2).zfill(8)) # -0000100
print('{0:b}'.format(bitNegative10 << 2).zfill(8)) # -0101000
# Bitwise Right Shift Operator
print();
print('{0:b}'.format(bitZero >> 2).zfill(8)) # 00000000
print('{0:b}'.format(bitPositiveOne >> 2).zfill(8)) # 00000000
print('{0:b}'.format(bitPositive10 >> 2).zfill(8)) # 00000010
# 음수 기호는 부호자리는 영향을 주지 않음
print('{0:b}'.format(bitNegativeOne >> 2).zfill(8)) # -0000001
# 음수 기호는 다른 패턴을 보임(2의 보수 ?)
print('{0:b}'.format(bitNegative10 >> 2).zfill(8)) # -0000011
8. 연산자 우선순위
순위 | 연산자 | 설명 |
1 | ** | 지수 연산 |
2 | ~ + - | 보수, 단항 더하기 및 빼기 |
3 | * / % // | 곱하기, 나누기, 나머지, 몫 |
4 | + - | 덧셈, 뺄셈 |
5 | >> << | 좌우 비트 쉬프트 |
6 | & | 비트 논리 곱 |
7 | ^ | | 배타적 논리 합, 비트 논리 합 |
8 | <= < > >= | 비교 연산자 |
9 | <> == != | 평등 연산자 |
10 | = %= /= //= += -= ^= **= | 할당 연산자 |
11 | is is not | 아이덴티 연산자 |
12 | in not in | 멤버쉽 연산자 |
13 | not or and | 논리 연산자 |
'Python Language' 카테고리의 다른 글
[Python Basic] 07. 반복문(Loops) (0) | 2020.02.11 |
---|---|
[Python Basic] 06. 분기문(Decision Making) (0) | 2020.02.11 |
[Python Basic] 04. 변수 타입(Variable Type) (0) | 2020.02.11 |
[Python-Basic] 03. 파이썬 기본 구문 (0) | 2020.02.11 |
[Python-Basic] 02. 파이썬 개발 환경 구축 (0) | 2020.02.11 |