Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- print ("Kalkulator (10) -> (x)\n")
- def z_dziesietnego ( liczba, a):
- tablica = []
- wynik = 0
- WARTOSCI = (
- ('A', 'a', 10),
- ("B", "b", 11),
- ("C", "c", 12),
- ("D", "d", 13),
- ("E", "e", 14),
- ("F", "f", 15),
- )
- while (liczba > 0):
- x = liczba % a
- if (x<10):
- tablica.append (x)
- else:
- for duza, mala, dwucyfr in WARTOSCI:
- if (x == dwucyfr):
- tablica.append (duza)
- break
- liczba = int ( liczba / a)
- tablica.reverse()
- return tablica
- liczba = int (input ("Wprowadz liczbe w systemie dziesiatkowym:"))
- a = int (input ("Wprowadz system wyjsciowy (2-16):"))
- wynik = z_dziesietnego (liczba, a)
- print ("\nTa liczba w systemie",a,"to ", end="")
- for x in wynik:
- print (x, end ="")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement