Skip to main content

Convert numbers between different numeral systems.

Project description

nsystems

Info

This Python package is used for converting any number from any numeral system (ex. binary), to whatever numeral system you want (if it's not greater than base64).

Python offers this function, but it is very limited (you can only convert bases: 2, 8, 16). With our user-friendly package, you'll be able to convert between any numeral systems (> base64).

 


Installation

It's dead easy.

You just run:

pip install nsystems

in your terminal.

 


Usage

We made our package pretty easy to use.

 

Common functions

  • convert()
  • base2()
  • base8()
  • base10()
  • base16()
  • base32()
  • base64()

 

convert()

This function is used to convert a number from, to whatever numeral system you want.

Arguments taken Type Default value
value str (no default value)
to_base int 16
from_base int 10

Example:

from nsystems import convert

converted = convert('123', 2)
print(converted)

# output: 1111011

 

base2(), base8(), base16(), base32(), base64()

These functions are very similar to each other, so we've put them in one explanation. These are also similar to the convert() function, but have like the to_base argument fixed to the base they are.

Arguments taken Type Default value
value str (no default value)
from_base int 10

Example:

from nsystems import base64

converted = base64('123')
print(converted)

# output: 1x

 

base10()

This function converts to base10 (decimal) from any other numeral system.

Arguments taken Type Default value
value str (no default value)
from_base int 16

Example:

from nsystems import base10

converted = base10('1111011', 2)
print(converted)

# output: 123

 

PRO functions

  • characters()

 

characters()

If you want to change the character list, this function is for that.

The default character list are these characters (0-9, A-Z, a-z, +, =).

With this function you can choose whether you want to get large or small letters first, and the two special characters at the end (the numbers are always at the beginning).

Arguments taken Type Default value
AZ_or_az str (options: 'AZ' or 'az') (no default value)
az_or_AZ str (options: 'AZ' or 'az') (no default value)
special_character_1 str (no default value)
special_character_2 str (no default value)

Example:

from nsystems import characters

characters('az', 'AZ', '+', '/')

# now the character list is: 0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ+/

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nsystems-0.3.0.tar.gz (3.9 kB view details)

Uploaded Source

Built Distribution

nsystems-0.3.0-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

Details for the file nsystems-0.3.0.tar.gz.

File metadata

  • Download URL: nsystems-0.3.0.tar.gz
  • Upload date:
  • Size: 3.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.1

File hashes

Hashes for nsystems-0.3.0.tar.gz
Algorithm Hash digest
SHA256 0607ef2b3be0e4458ffbf481aba90ebf3672d3498c4e36e1bfce9b2d16180419
MD5 22dfb8e2087df1320a52b2f26334eed0
BLAKE2b-256 a8f83c8cdd62d3f2d817245b53b62924b393527183cd60bc2b29f61233ec0928

See more details on using hashes here.

File details

Details for the file nsystems-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: nsystems-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 4.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.1

File hashes

Hashes for nsystems-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 535c65057540539ca3e59c673ab61158e803e6bdde98d9af997bf28dc8be759c
MD5 d1675ce40066d411c9076851dfea3d91
BLAKE2b-256 a6023c9f4c04e01f06ac19144f1c5f217e79615f419c0557d590f4dbd4210430

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page