From 57366da73385b661b1cc1150f175b7f625ee9a1f Mon Sep 17 00:00:00 2001
From: ajito nelson <8997ajito@gmail.com>
Date: Thu, 4 Apr 2024 15:30:50 +0900
Subject: [PATCH] operasaun bitwise
---
operasaun bitwise/README.md | 66 +++++++++++++++++++++++++++
operasaun bitwise/exerciciu/README.md | 49 ++++++++++++++++++++
operasaun bitwise/kode.py | 19 ++++++++
3 files changed, 134 insertions(+)
create mode 100644 operasaun bitwise/README.md
create mode 100644 operasaun bitwise/exerciciu/README.md
create mode 100644 operasaun bitwise/kode.py
diff --git a/operasaun bitwise/README.md b/operasaun bitwise/README.md
new file mode 100644
index 0000000..18c7543
--- /dev/null
+++ b/operasaun bitwise/README.md
@@ -0,0 +1,66 @@
+# Operasaun bitwise
+
+Operasaun bitwise iha Python permite ita halo operasaun aaritmétika iha nível bit. Iha Python, ita bele uza operadores bitwise hanesan `&` (AND bit-a-bit), `|` (OR bit-a-bit), `^` (XOR bit-a-bit), `~` (NOT bit-a-bit), `<<` (Shift left), no `>>` (Shift right) atu manipula valores iha nível bit.
+
+Lista operadores bitwise sira:
+
+1. `&`: AND bit-a-bit.
+2. `|`: OR bit-a-bit.
+3. `^`: XOR bit-a-bit.
+4. `~`: NOT bit-a-bit.
+5. `<<`: Shift left.
+6. `>>`: Shift right.
+
+Ezemplu sira:
+
+```python
+# AND bit-a-bit
+print(5 & 3) # Sai 1 (101 & 011 = 001)
+
+# OR bit-a-bit
+print(5 | 3) # Sai 7 (101 | 011 = 111)
+
+# XOR bit-a-bit
+print(5 ^ 3) # Sai 6 (101 ^ 011 = 110)
+
+# NOT bit-a-bit
+print(~5) # Sai -6 (~101 = -110)
+
+# Shift left
+print(5 << 1) # Sai 10 (101 << 1 = 1010)
+
+# Shift right
+print(5 >> 1) # Sai 2 (101 >> 1 = 10)
+```
+
+### BITWISE
+
+
+
+### EZAMPLE
+
+#### AND
+
+
+
+#### OR
+
+
+
+#### XOR
+
+
+
+#### Bitwise Ones’ Complement Operator
+
+
+
+#### Shift Left
+
+
+
+#### Shift Right
+
+
+
+Referencia : https://www.digitalocean.com/community/tutorials/python-bitwise-operators
diff --git a/operasaun bitwise/exerciciu/README.md b/operasaun bitwise/exerciciu/README.md
new file mode 100644
index 0000000..aa9157b
--- /dev/null
+++ b/operasaun bitwise/exerciciu/README.md
@@ -0,0 +1,49 @@
+### Exerciciu I
+
+Klaru! Hau sei fó imi alguns exercísiu sira hodi pratika operadores bitwise iha Python:
+
+1. **Exercísiu 1**: Kalkula AND bit-a-bit entre númeru 10 no 7.
+
+```python
+resultado = 10 & 7
+print("AND bit-a-bit entre 10 no 7:", resultado)
+```
+
+2. **Exercísiu 2**: Kalkula OR bit-a-bit entre númeru 10 no 7.
+
+```python
+resultado = 10 | 7
+print("OR bit-a-bit entre 10 no 7:", resultado)
+```
+
+3. **Exercísiu 3**: Kalkula XOR bit-a-bit entre númeru 10 no 7.
+
+```python
+resultado = 10 ^ 7
+print("XOR bit-a-bit entre 10 no 7:", resultado)
+```
+
+4. **Exercísiu 4**: Kalkula NOT bit-a-bit ba númeru 10.
+
+```python
+resultado = ~10
+print("NOT bit-a-bit ba 10:", resultado)
+```
+
+5. **Exercísiu 5**: Shift left 2 posisaun ba númeru 10.
+
+```python
+resultado = 10 << 2
+print("Shift left 2 posisaun ba 10:", resultado)
+```
+
+6. **Exercísiu 6**: Shift right 2 posisaun ba númeru 10.
+
+```python
+resultado = 10 >> 2
+print("Shift right 2 posisaun ba 10:", resultado)
+```
+
+```python
+print(format(5 ^ 3, '08b'))
+```
diff --git a/operasaun bitwise/kode.py b/operasaun bitwise/kode.py
new file mode 100644
index 0000000..171cf61
--- /dev/null
+++ b/operasaun bitwise/kode.py
@@ -0,0 +1,19 @@
+# AND bit-a-bit
+print(5 & 3) # Sai 1 (101 & 011 = 001)
+print(format(5 & 3, '08b'))
+
+# OR bit-a-bit
+print(5 | 3) # Sai 7 (101 | 011 = 111)
+print(format(5 | 3, '08b'))
+# XOR bit-a-bit
+print(5 ^ 3) # Sai 6 (101 ^ 011 = 110)
+print(format(5 ^ 3, '08b'))
+# NOT bit-a-bit
+print(~5) # Sai -6 (~101 = -110)
+print(format(~5, '08b'))
+# Shift left
+print(5 << 1) # Sai 10 (101 << 1 = 1010)
+print(format(5 << 1, '08b'))
+# Shift right
+print(5 >> 1) # Sai 2 (101 >> 1 = 10)
+print(format(5 >> 1, '08b'))
\ No newline at end of file