Skip to main content

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

⚠️ 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

❗ Always Try entering arguments as String only

❗ Conversion functions automatically check input arguments, you don't need to check them manually

binchecker(n)

Checks if passed argument is suitable for Binary System or not

>>> binchecker('11011')
True
>>> binchecker('213')
InvalidInputError: invalid Binary Number
>>>

decchecker(n)

Checks if passed argument is suitable for Decimal System or not

>>> decchecker('75412')
True
>>> decchecker('a34b')
InvalidInputError: invalid Decimal Number
>>>

octchecker(n)

Checks if passed argument is suitable for Octal System or not

>>> octchecker('752')
True
>>> octhecker('8249')
InvalidInputError: invalid Octal Number
>>>

hexchecker(n)

Checks if passed argument is suitable for Hexadecimal System or not

>>> hexchecker('7ac2')
True
>>> hexchecker('a34jrt')
InvalidInputError: invalid Hexadecimal Number
>>>

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.

Metadata

Release files for numbersystems 1.50

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for numbersystems 1.50
File Size Uploaded Provenance Actions
numbersystems-1.50.tar.gz 4.3 kB Without provenance Details for numbersystems-1.50.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for numbersystems 1.50
File Interpreter ABI Platform Actions
numbersystems-1.50-py3-none-any.whl Python 3 none any Details for numbersystems-1.50-py3-none-any.whl

Total release size: 9.1 kB

Release files / numbersystems-1.50.tar.gz

Download URL numbersystems-1.50.tar.gz
Size 4.3 kB
Tags Source
SHA-256 checksum
How to use checksums
f7f6522f814cc4fd1af1e88d87593ced1f54193485ae30a19491ff6b51956590
BLAKE2b-256 checksum
How to use checksums
3608b35f204c9cc0769886fe819534e0b9eff2334f5d257f0de32e33141123fb
Upload date
Uploaded using Trusted Publishing?
What is 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

Release files / numbersystems-1.50-py3-none-any.whl

Download URL numbersystems-1.50-py3-none-any.whl
Size 4.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
90d1c29b737973b64326855c967cedd7b5aa44c3f0f56b9ac2943490b6b6a7bc
BLAKE2b-256 checksum
How to use checksums
018b5147d34700e53b58ee4f1ee93c9c08cb60028021f4690cae9d16dd9bec7f
Upload date
Uploaded using Trusted Publishing?
What is 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

Security for numbersystems 1.50

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.50 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page