Python provides various bitwise operators that allow for convenient manipulation of the individual bits of a binary representation of an integer.
For example, the integer 23 is represented in binary with rightmost bits 00010111 and the integer 13 is represented in binary with rightmost bits 00001101.
The bitwise and operation, 23 & 13, produces integer 5, which has bit 1 in each position for which both 23 and 13 have a 1.
'python' 카테고리의 다른 글
Iterable, Iterator, Generator (0) | 2025.02.21 |
---|---|
Files and Exceptions (0) | 2025.02.10 |
Tuple 튜플 (0) | 2025.01.26 |
List 리스트 (0) | 2025.01.26 |
Terminating a Program (프로그램 종료) (0) | 2025.01.12 |