+ 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 Answers
+ 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