A simple Python class to easily convert numbers between different bases.
Supports conversions between binary, decimal, octal, and hexadecimal with a clean and easy-to-use interface.
- π Lightweight and beginner-friendly Python class
- π Convert numbers between any bases (binary, decimal, octal, hexadecimal)
- β‘ Fast and accurate results
- π» Works with Python 3.x and higher
Create an instance of the class and call the convert method:
from BaseConverter import BaseConverter
app = BaseConverter()
result = app.convert(number, FromBase, ToBase)
print(result)Example:
app = BaseConverter()
result = app.convert(1519, 10, 2)
print(result) # Outputs binary representation of 1519Parameters:
numberβ The number to convertFromBaseβ Source base (e.g., 10 for decimal)ToBaseβ Target base (e.g., 2 for binary)
π‘ Feel free to reach out if you have any questions or suggestions!
β If you like this project, donβt forget to star the repo!