Skip to content

Change numeric base using Python

Hello,

How to change the numeric base of a number? This is a implementation in Python.

[code lang=”python”]
def convert(decimal,newBase,str,letters):
if decimal >= newBase:
x = decimal % newBase
y = decimal / newBase
str = letters[x] + str
if y < newBase: str = letters[y] + str return convert(y,newBase,str,letters) else: if len(str) == 0: str = letters[decimal] + str return str let = "0123456789ABCDEF" print convert(17,16,"",let) [/code] The variable let means what values used in the base. For an example if you want binary you should replace with 01. Matheus

Published inAprendendopython

2,390 Comments

  1. 888 poker promotion code united states, free pokie
    games united kingdom and how many crown casino net profit;
    Elma, are in australia, or united statesn casino free spins
    no deposit

  2. can you play online pokies in united states for real money,
    $5 facts about gambling, Sherita, minimum deposit casino new zealand 2021 and age of gods slots uk, or online casino real money canada paysafe

  3. triple shot pokies united states, free deposit casino uk and casino in milwaukee wisconsin, or is there a casino in mobile
    al – Nannie – online gambling in canada legal

  4. all new zealandn poker rules, online casino paypal deposit usa and casino deposit bonus
    usa, or free casino playing tips (Amos) bonus united states

  5. casinos in toronto ontario australia, no best £10 deposit bonus
    – Hildred,
    canada casino bonus and online casino canada no deposit
    sign up bonus, or parhaat casino tarjousaset

  6. Ian Ian

    regulation of gambling in canada, casino online united states bc and free online poker united states, or top online pokies and mt securetrade casinos, Ian, united statesn league

  7. fair go australia pokies, western australian poker league and run it once poker canada, or
    united kingdom roulette betting strategy

    Review my web blog: blue chip casino spa tower (Lucile)

  8. aj beuka high stakes poker, united statesn craps roulette (Dino) wheel number order and online casino groups usa, or awesome online casino
    new zealand

  9. casinos australia no deposit bonus, online what time does ameristar casino open tomorrow
    (Alda) pokies
    australia and united kingdom online pokies that accept paysafe,
    or bet365 craps strategies usa

  10. cahuilla casino anza ca, online casinos cheat you (Taylah) pokies free spins on sign up australia and australian free pokies games, or
    best casino sign up offers uk

  11. betsoft casinos united kingdom no deposit bonus, casino new south wales united states and
    online casino australia free spins sign up, or online
    gambling websites usa

    Also visit my page :: blackjack progressive betting strategy – Jeremy,

  12. Hai Hai

    fully cashable no deposit bonus canada, 2021 online casino new zealand
    and new no deposit bonus winner casino free (Hai) uk, or united states live
    casino

  13. canadian poker stars, united kingdom tax casino
    winnings and rules of roulette uk, or new zealandn online betika casino games login (Darla) pokies

  14. how many online casinos in usa, online pokies australia real money paysafe
    and how to calculate roulette probability [Kourtney] to win china africa bonausaa slot machine, or latest free spins no
    deposit usa

  15. australia online how to bet in a casino; Beryl, bonus, play real
    money poker online australia and casino apps real money australia, or remote gambling association uk

  16. Нержавеющая сталь 12Х18Н10Т — одна из самых популярных марок аустенитной нержавеющей стали в промышленности. Добавка титана в составе сталь не склонна к межкристаллитному разрушению в широком диапазоне температур.

    Подробная информация: https://stal-12h18n10t.ru/analogi

    Материал используется в пищевом производстве — для изготовления труб, ёмкостей и теплообменников. Эквиваленты по международным стандартам: AISI 321, EN 1.4541 (Европа), SUS 321 (Япония).

Leave a Reply

Your email address will not be published. Required fields are marked *