---
# System prepended metadata

title: WDI 4.5

---

# WDI 4.5
do poprawki

```python=
from wdi import *
def palindrom(n):
    i = 0
    j = 0
    X = Array(100)
    X[0] = n % 2
    n = n // 2
    while n > 0:
        i = i + 1
        X[i] = n % 2
        n = n // 2
    while i > j:
        if X[j] != X[i]:
            return False
        i -= 1
        j += 1
    return True

print(palindrom(22))
print(palindrom(31))
        
        
    




#v2
from wdi.lib.wdi import Array


def palindrom(n):
    j = 2
    binary = bin(n)
    binary_length = len(binary)
    i = binary_length - 1
    while j < binary_length:
        if binary[j] != binary[i]:
            print("False")
            return
        i -= 1
        j += 1
    print("True")        


palindrom(196)

```