+ 6

Number Conversion Challenge

Write a program to take a no. n and convert it into roman numerals. for eg. input : 15 output : XV

27th Jul 2017, 7:02 AM
Lakshay
Lakshay - avatar
5 ответов
+ 6
Nice idea. Wait, I am groggy from waking up.
28th Jul 2017, 11:07 PM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 3
lets try....
27th Jul 2017, 7:28 AM
Ashwaghosh Sadanshiv
Ashwaghosh Sadanshiv - avatar
+ 3
I have made it. But the program is quite large. https://code.sololearn.com/cwISOQ76jLp3/?ref=app
27th Jul 2017, 10:32 AM
Lakshay
Lakshay - avatar
27th Jul 2017, 8:19 AM
Александр Громозонов
Александр Громозонов - avatar
+ 1
romans = [(1000, "M"), (900, "CM"), (500, "D"), (400, "CD"), (100, "C"), (90, "XC"), (50, "L"), (40, "XL"), (10, "X"), (9, "IX"), (5, "V"), (4, "IV"), (1, "I")] def convert_to_roman(num): out = "" for a, b in romans: q, num = divmod(num, a) out += q*b return out user_input = int(input("Enter a number to convert to Roman Numeral: ")) print() print(convert_to_roman(user_input))
27th Jul 2017, 10:01 AM
ChaoticDawg
ChaoticDawg - avatar