Skip to main content

Numeral systems, binary, roman, integer

Project description

RomanNumbers
============
[![Build Status](https://travis-ci.org/RedXBeard/RomanNumbers.svg?branch=master)](https://travis-ci.org/RedXBeard/RomanNumbers)

Roman or Integer numbers can be converted into eachother an additionally representation of each one of them into binary
format.

Installation
------------

```bash
$ pip install RomanAlphabet
```

Usage
-----
To represent an integer value into roman numeral system;

```ipython
: from romanalphabet.romanalphabet import RomanAlphabet
: rr = RomanAlphabet("4785")
: rr.convert_to_roman()
: 'MMMMDCCLXXXV'
```

or into binary;

```ipython
...
: rr.convert_to_binary()
: '1001010110001'
```

Also roman numbers can be an input and represented with integer and binary format. If anything will goes wrong then for input as an example, none roman numerics if given then an understandable error will displayed.

```ipython
: rr = RomanAlphabet("CVII")
: rr.convert_to_int()
: 107
: rr.convert_to_binary()
: 1101011
: rr = RomanAlphabet("MXXCVII")
---------------------------------------------------------------------------
InvalidInputError Traceback (most recent call last)
<ipython-input-4-928ae041fe2c> in <module>()
----> 1 rr = RomanAlphabet("MXXCVII")

/Users/barbaros/.virtualenvs/RomanAlphabet/project/RomanNumbers/romanalphabet/romanalphabet.py in __init__(self, input)
21 if not result:
22 raise InvalidInputError, ---> 23 "Input has unqualified chars; '%s'" % message
24
25 @staticmethod

InvalidInputError: Input has unqualified chars; 'MXXCVII'
: rr = RomanAlphabet("CTII")
---------------------------------------------------------------------------
InvalidInputError Traceback (most recent call last)
<ipython-input-5-9cb900ee7522> in <module>()
----> 1 rr = RomanAlphabet("TVII")

/Users/barbaros/.virtualenvs/RomanAlphabet/project/RomanNumbers/romanalphabet/romanalphabet.py in __init__(self, input)
21 if not result:
22 raise InvalidInputError, ---> 23 "Input has unqualified chars; '%s'" % message
24
25 @staticmethod

InvalidInputError: Input has unqualified chars; 'T'
```

Project details


Release history Release notifications

History Node

1.4

History Node

1.3

History Node

1.2

History Node

1.1

This version
History Node

1.0

History Node

0.3

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
RomanAlphabet-1.0.tar.gz (3.6 kB) Copy SHA256 hash SHA256 Source None Sep 4, 2014

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page