+
Skip to content

TheItcor/NumeralBase

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

NumeralBase

Python library for working with various numeral systems.

Download

pip install numeralbase

Converting

number = convert_base('10A', 16, 10) # Number for convert; number base; convertion to base
# '10A' -> '266'

You can convert numbers up to 176 numeric system.

number = convert_base('10A', 16, 176)
# '10A' -> '1ε'

Or use your own alphabet for the numeric system:

number = convert_base('10A', 16, 2000, '01234(...)*%$&$@w!')

Class NumeralNumber

Also, special class for non-decimal numbres:

n1 = NumeralNumber("1010", 2)
n2 = NumeralNumber("FF", 16)

Arithmetic

You can use arithmetic operations for the numbers that will be in the class.

print(n1 + n2)  # 10100101 (265)

print(n2 - n1)  # F5 (245)

print(n1 * n2)  # 111111100110 (2550)

About

Python library for working with different number systems

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载