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,430 Comments

  1. new zealandn online casino 5 dollar min deposit, free online games that can earn money (Ofelia) slots cash frenzy and australia slot online,
    or paypal online casino uk

  2. Clearwater adult center clearwater flSex with love movie clipsSinger upskirtSex clips fake big titsMature vintage moms fuckingHairy mom pussyDildo girl like
    whoGerman girls nudist naked pics freeKirstyn halborg escortFirst
    hard cock xnxx Plump hairy pussiesVideos pornos de t v
    gratisFunny sexy dogsFree bbw gangbang sitesVideo porn of boysIs pharrel williams
    asianTiny girl fuck xnxxhealth.cc Porn star
    list vintageBoobs getting beatenCompilation cumaholic teensNude teen boys caught on webcamVintage intel 80186Pleasures of the flesh 4Teen blonde shaved pussyLos angeles
    vintage kimonoPussy bidat xnxx Kardashian oral sex sceneT
    shirt stripElena hunter kina lesbian teenJanic pennington nudeCool tube young sexBlack teen model galleryVintage flatware jewelryGay black
    bulls big cocks forumPantyhose dare girlsBi mmf group sexGay real world houseBrandon florida
    sexual encountersVintage rhinestone bracelet b davidCreate a hot
    sexy girlChalene site erotic

  3. Ali Ali

    canadian online pokies that accept paypal, merkur no deposit bonus (Ali) deposit online casino united states and top online pokies and casinos australian open, or buy bingo game australia

  4. best gambling in aruba (Ross) usa online casinos that
    payout, online slots usa fast withdrawal and real
    money online casinos united states, or new zealand star casino

Leave a Reply

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