Web M&M
https://mam.matfyz.cz
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
12 lines
302 B
12 lines
302 B
# -*- coding: utf-8 -*-
|
|
|
|
def roman(num):
|
|
ints = (1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1)
|
|
nums = ('M', 'CM', 'D', 'CD','C', 'XC','L','XL','X','IX','V','IV','I')
|
|
res = ""
|
|
for i, n in zip(ints, nums):
|
|
res += n * (num // i)
|
|
num %= i
|
|
return res
|
|
|
|
|
|
|