Initial commit of int-to-roman.py

pull/1207/head
Matthew Volpe 2023-06-21 17:50:10 -04:00
parent d3c2184af8
commit ce40163169
1 changed files with 23 additions and 0 deletions

View File

@ -0,0 +1,23 @@
'''
Output the correct Roman numerals for a given number.
Input: 1994
Output: MCMXCIV
MDCD
Time Complexity: ???
Space Complexity: ???
'''
def int_to_roman(num):
reference = [("M", 1000), ("CM", 900), ("D", 500), ("CD", 400), ("C", 100), ("XC", 90), ("L", 50), ("XL", 40), ("X", 10), ("IX", 9), ("V", 5), ("IV", 4), ("I", 1)]
for numeral in range(len(reference)):
if numeral[1]:
...
if __name__ == "__main__":
print(int_to_roman(1994))
# MCMXCIV