All pastes #2120736 Raw Edit

Unnamed

public text v1 · immutable
#2120736 ·published 2012-02-22 11:35 UTC
rendered paste body
integers = [5000, 1000, 500, 100, 50, 10, 5, 1]
numerals = ['M', 'D', 'C', 'L', 'X', 'V', 'I']
buffer = int(input("int: "))
output = ""
i = 0
for x in integers:
    if buffer / x >= 1:
        for y in range(0, round(buffer / x)):
            output += numerals[i - 1]
            buffer -= x
    i += 1
print("roman: " + output)