0

I am creating a way to convert an Arabic Numeral into a Roman Numeral. If the Arabic numeral to be converted is 124 I would like to create a list List that contains the values 100, 20, and 4. So basically I need to somehow find the base 10 decomposition of 124, and create a list of the values. Another example: 1,891 = 1,000 + 800 + 90 + 1, so the list could look like this: `list = [1000, 800, 90, 1]. I hope this explanation isn't too obscure for you to understand, and thank you.

1 Answers1

0

Something like this would work:

def Roman(input):
    digits = [int(i) for i in list(str(input))]
    powers = range(len(digits))
    powers.reverse()
    return [digit * 10 ** power for digit, power in zip(digits, powers)]
Mike
  • 6,813
  • 4
  • 29
  • 50