Last active
January 23, 2019 17:58
-
-
Save ReeceHub/b5b1ba8376bdaa6a97fa232608c53da9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def add(first, second): | |
smooshed = ''.join(sorted(first + second, reverse=True)) | |
smooshed = smooshed.replace('IIIII', 'V') | |
smooshed = smooshed.replace('VV', 'X') | |
smooshed = smooshed.replace('XXXXX', 'L') | |
return smooshed |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from roman_numerals import add | |
import pytest | |
def test_one_plus_one(): | |
assert add('I', 'I') == 'II' | |
def test_one_plus_two(): | |
assert add('I', 'II') == 'III' | |
assert add('II', 'I') == 'III' | |
def test_three_plus_two(): | |
assert add('III', 'II') == 'V' | |
def test_five_plus_one(): | |
assert add('V', 'I') == 'VI' | |
def test_five_plus_file(): | |
assert add('V', 'V') == 'X' | |
def test_seven_plus_three(): | |
assert add('VII', 'III') == 'X' | |
def test_thirty_plus_twenty(): | |
assert add('XXX', 'XX') == 'L' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment