diff --git a/duodecimal.py b/BaseConverter.py similarity index 98% rename from duodecimal.py rename to BaseConverter.py index be774ca..9b3e51f 100644 --- a/duodecimal.py +++ b/BaseConverter.py @@ -95,8 +95,8 @@ class BaseConverter: else: sign = 1 - if set(string) > set(digits): - invalid = set(string) - set(digits) + if set(string) > set(digits+'.'): + invalid = set(string) - set(digits+'.') raise ValueError('invalid character'.format(invalid)) if '.' in string: diff --git a/example_usage.ipynb b/example_usage.ipynb index f06c7b6..f34d928 100644 --- a/example_usage.ipynb +++ b/example_usage.ipynb @@ -12,10 +12,12 @@ { "cell_type": "code", "execution_count": 1, - "metadata": {}, + "metadata": { + "collapsed": true + }, "outputs": [], "source": [ - "from duodecimal import BaseConverter, duo, binary" + "from BaseConverter import BaseConverter, duo, binary" ] }, { @@ -208,7 +210,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": 2, "metadata": {}, "outputs": [ { @@ -217,7 +219,7 @@ "1010(base2)" ] }, - "execution_count": 9, + "execution_count": 2, "metadata": {}, "output_type": "execute_result" } @@ -228,7 +230,7 @@ }, { "cell_type": "code", - "execution_count": 26, + "execution_count": 3, "metadata": {}, "outputs": [ { @@ -237,7 +239,7 @@ "False" ] }, - "execution_count": 26, + "execution_count": 3, "metadata": {}, "output_type": "execute_result" } @@ -248,7 +250,7 @@ }, { "cell_type": "code", - "execution_count": 31, + "execution_count": 4, "metadata": {}, "outputs": [ { @@ -257,7 +259,7 @@ "'42'" ] }, - "execution_count": 31, + "execution_count": 4, "metadata": {}, "output_type": "execute_result" }