Skip to main content

Convert roman numeral to number and manage roman number object

Project description

Roman numerals

Manage roman numerals using roman number object.

Convert roman numeral to integers

  • roman function

return roman numeral string

import roman_numbers as r

x = 10
print(r.roman(x))

Output:

>> X
  • roman(number:int, extend=1) extended function

return roman numeral string

import roman_numbers as r

x = 7580
print(r.roman(x, extend=1))

Output:

>> V̅MMDLXXX
  • number function

return integers from roman numeral

import roman_numbers as r

x = 'X'
print(r.number(x))

Output:

>> 10
  • rom object

support Basic and Compare opeartion for roman numeral

from roman_numbers import rom

>> rom(10) + rom(10) # add
>> XX

>> rom(5) - rom(1) # sub
>> IV

>> rom(5) * 3 # mul
>> XV

>> rom('V') > rom('XI') # compare
>> False

>> rom('V') == 5 # compare
>> True

>> int(rom('XI'))
>> 11

Version

1.0.1 - Release 1.0.2 - Add description and minor fix

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

roman_numbers-1.0.2.tar.gz (2.6 kB view hashes)

Uploaded Source

Built Distribution

roman_numbers-1.0.2-py3-none-any.whl (3.7 kB view hashes)

Uploaded Python 3

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