Update README.md

This commit is contained in:
Marina S 2023-07-30 21:44:51 -07:00 committed by GitHub
parent da47a56961
commit 913a26b906
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,33 +1,5 @@
## bit manipulation
<br>
### `playing_with_bits.py`
<br>
```python
> python3 playing_with_bits.py
Integer number: 144
Binary number: 10010000
Update bit: 0b10010100
Set bit: 0b10010100
Clear bit: 0b10000000
I: 144, I2: 90
B: 10010000, B2: 01011010
Count bits swapped: 4
Swap bit in place: (90, 144)
```
----
### bit manipulations
<br>
@ -134,4 +106,34 @@ Swap bit in place: (90, 144)
* an integer of type int can be represented as a 32-bit binary number.
* since a one-digit hexadecimal number corresponds to a four-digit binary number, an integer of type int can also be represented as an 8-bit hexadecimal number.
<br>
---
### examples
<br>
#### `playing_with_bits.py`
<br>
```python
> python3 playing_with_bits.py
Integer number: 144
Binary number: 10010000
Update bit: 0b10010100
Set bit: 0b10010100
Clear bit: 0b10000000
I: 144, I2: 90
B: 10010000, B2: 01011010
Count bits swapped: 4
Swap bit in place: (90, 144)
```