Learn to Code
John F. Dumas
contact me | resume | how it works | example programs | testimonials | main page

Python - Roman Numerals


► Problem Description: Write a function 'toRoman' to convert a number to its roman numeral equivalent. Have your program convert all numbers from 1 to 3999 to roman numerals and output the results. The file 'roman-numerals.txt' listed below under the Source Code section shows the correct output for the sake of comparison.


► Example Output:

   1 => I
   2 => II
   3 => III
   4 => IV
   5 => V
   6 => VI
   7 => VII
   8 => VIII
   ...
   3992 => MMMCMXCII
   3993 => MMMCMXCIII
   3994 => MMMCMXCIV
   3995 => MMMCMXCV
   3996 => MMMCMXCVI
   3997 => MMMCMXCVII
   3998 => MMMCMXCVIII
   3999 => MMMCMXCIX


► Source Code

All files (zip file)


Back to Example Program Index


© John F. Dumas | johnfdumas@gmail.com | main page | top of page