Skip to main content

Python Module to convert one Number System to other with ease

Project description

Number Systems

forthebadge made-with-python forthebadge

Python Module To Quickly Convert One Number System to Another.

Installations

Install using pip

pip install numbersystems

Usage

:warning: Use converter while importing the module, not numbersystems

To start using this Module, import it

import converter

or Wildcard import

from converter import *

Functions

Functions To Check Input :

  • binchecker():
  • octchecker()
  • decchecker()
  • hexchecker()

Conversion Functions :

  • dectobin()
  • bintodec()
  • dectooct()
  • octtobin()
  • octtodec()
  • bintooct()
  • hextobin()
  • hextodec()
  • hextooct()
  • dectohex()
  • bintohex()

Using Functions

binchecker(n)

Checks if passed argument is sutiable for Binary System or not

decchecker(n)

Checks if passed argument is sutiable for Decimal System or not

octchecker(n)

Checks if passed argument is sutiable for Octal System or not

hexchecker(n)

Checks if passed argument is sutiable for Hexadecimal System or not

dectobin(x)

It Converts Decimal to Binary, takes Decimal value as Parameter, returns Binary equivalent

>>> dectobin(2)
10
>>>

bintodec(x)

It Converts Binary to Decimal, takes Binary value as Parameter, returns Decimal equivalent

>>> dectobin(101)
5
>>>

dectooct(x)

It Converts Decimal to Octal, takes Decimal value as Parameter, returns Octal equivalent

>>> dectooct(12)
14
>>>

octtobin(x)

It Converts Octal to Binary, takes Octal value as Parameter, returns Binary equivalent

>>> octtobin(12)
1010
>>>

octtodec(x)

It Converts Octal to Decimal, takes Octal value as Parameter, returns Decimal equivalent

>>> dectooct(12)
10
>>>

bintooct(x)

It Converts Binary to Octal, takes Binary value as Parameter, returns Octal equivalent

>>> bintooct(10101)
25
>>>

hextobin(x)

It Converts Hexadecimal to Binary, takes Hexadecimal value as Parameter, returns Binary equivalent

>>> hextobin(15)
10101
>>>

hextodec(x)

It Converts Hexadecimal to Decimal, takes Hexadecimal value as Parameter, returns Decimal equivalent

>>> hextodec(15)
21
>>>

hextooct(x)

It Converts Hexadecimal to Octal, takes Hexadecimal value as Parameter, returns Octal equivalent

>>> hextooct(15)
25
>>>

dectohex(x)

It Converts Decimal to Hexadecimal, takes Decimal value as Parameter, returns Hexadecimal equivalent

>>> hextobin(15)
10101
>>>

bintohex(x)

It Converts Binary to Hexadecimal, takes Binary value as Parameter, returns Hexadecimal equivalent

>>> bintohex(10101)
15
>>>

Errors

In case of the Wrong Type of Data given as an input to the Function, InvalidInputError is raised.

It is suggested to check the input value again if the Error is raised.

If the input value to the function is fine, still Error rises, please open a new Issue on Github.

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

numbersystems-1.2.tar.gz (4.0 kB view details)

Uploaded Source

Built Distribution

numbersystems-1.2-py3-none-any.whl (4.6 kB view details)

Uploaded Python 3

File details

Details for the file numbersystems-1.2.tar.gz.

File metadata

  • Download URL: numbersystems-1.2.tar.gz
  • Upload date:
  • Size: 4.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.2

File hashes

Hashes for numbersystems-1.2.tar.gz
Algorithm Hash digest
SHA256 7538a5e6809ccc6744c599adabecff198977cc5b5f49f68d81055139d4ec2bed
MD5 93dcaf1b6963d64e27d4128fdc1f9986
BLAKE2b-256 22620f8de6c7f7829cd0242e91672a02cf4bed86dd801faf6302c8cc9c9a2c82

See more details on using hashes here.

File details

Details for the file numbersystems-1.2-py3-none-any.whl.

File metadata

  • Download URL: numbersystems-1.2-py3-none-any.whl
  • Upload date:
  • Size: 4.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.2

File hashes

Hashes for numbersystems-1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 7d13f51c51b1b6059e3da41fc98fa515f28019532a40b78495e69207caea0cc9
MD5 62b522f424b9657f39c87e95a0b8396c
BLAKE2b-256 ef0b920e92f34b3f2abed9b33fb89a8de3bd57629af55866c47d6fc4d5a39fc7

See more details on using hashes here.

Supported by

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