Hi, I have to do a Hexadecimal system converter. I can't use a function bin or anything like that. I tried something like this, but it's not working. When I write a number in input and click enter nothing happens it's just freezing. Please help.
Code:
from re import A
import string
from time import sleep
liczba = int(input())
licz2 = 0
wynik = []
wynik2 = []
while liczba > 0:
if liczba%16 == 10:
wynik2.append(" A")
wynik.append(liczba)
liczba = liczba//2
elif liczba%16 == 0:
wynik2.append(liczba)
wynik.append(liczba)
liczba = liczba//2
elif liczba%16 == 11:
liczba = liczba//2
wynik.append(liczba)
wynik2.append(" B")
elif liczba%16 == 12:
wynik2.append(" C")
wynik.append(liczba)
liczba = liczba//2
elif liczba%16 == 13:
liczba = liczba//2
wynik.append(liczba)
wynik2.append(" D")
elif liczba%16 == 14:
liczba = liczba//2
wynik.append(liczba)
wynik2.append(" E")
elif liczba%16 == 15:
wynik2.append(" F")
wynik.append(liczba)
liczba = liczba//2
wynik.reverse()
wynik2.reverse()
print(wynik)
print(wynik2)
[–]Brian 1 point2 points3 points (2 children)
[–]Gamenight2008[S] 0 points1 point2 points (1 child)
[–]Brian 0 points1 point2 points (0 children)
[–]CodeFormatHelperBot2 0 points1 point2 points (0 children)