Python Forum
How to work with Base 12 etc.
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to work with Base 12 etc.
#1
I am having fun working on puzzles from The American Cryptographic Association. I want to be able to work with numbers from other bases besides 10. 2, 8, and 16 are pretty easy. Having trouble finding ones like 11 and 12. I did try the base10toN function I found online but it does not seem to be working right for me. Giving me super long numbers with decimal points etc. Can someone point me in the right direction? Thanks.
Reply
#2
Use module gmpy2:
>>> import gmpy2
>>> gmpy2.digits(2383782, 12)                                                               
'96b606'
it works up to base 62.
Reply
#3
(Mar-05-2018, 07:24 AM)Gribouillis Wrote: Use module gmpy2:
>>> import gmpy2
>>> gmpy2.digits(2383782, 12)                                                               
'96b606'
it works up to base 62.

It took me about 30 minutes to try to understand how to install a .whl file. Not sure if I do but I think so. Now I can;t figure out which of the many versions of gmpy2 I should use with win10 (i5) and Python 3.6.
Can you point me to the right version? Or better yest a simple.py file? Thanks.
Reply
#4
The last one.
"As they say in Mexico 'dosvidaniya'. That makes two vidaniyas."
https://freedns.afraid.org
Reply
#5
(Mar-05-2018, 08:52 AM)wavic Wrote: The last one.

The upload dates are all the same. none of them say py ver 3.6....which one is the last one?
EDIT: Never mind. Finally figured it out.
Reply
#6
also need to know if you are running 32 or 64 bit OS.
dissect wheel name:
gmpy2-2.1.0a1-cp36-cp36m-win_amd64.whl (md5)
cp36 means cpython version 3.6
win_amd64 means 64 bit windows.
From that choose the one that fits your setup.
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020