[Tutor] Roman Numeral to Digital

Kent Johnson kent37 at tds.net
Thu Mar 8 11:58:31 CET 2007

Hi Alan,

I am forwarding your question to tutor at python.org which is the correct 
address for the list. tutor-owner at python.org sends questions to the 
*maintainers* of the list, not the list itself.


Alan Gilfoy wrote:
> I am learning how to program in python as a major component of my 
> school's senior project, and my most recent assignment was to write a 
> program that converts Roman numerals to digital (base-10 Arabic numerals).
> Now, I was told I have to write the program myself, but I was told I was 
> allowed to ask for hints. :)
> As of right now, I've written a user interface (after all, here that's a 
> simple loop-and-prompt setup leading to print statements), but I have 
> "dummy code" in the place where the conversion code needs to be.
> I want to create two separate functions:
> def.toRoman(digital_input)
>     print "Digital - to - Roman conversion (dummy code)"
>     roman_result = "XXX"
>     return roman_result
> def.toDigital(roman_input)
>     print "Roman - to - digital conversion (dummy code)"
>     digital_result = 30
>     return digital_result
> I'm going to set each of those two "inputs" by a prompt asking for what 
> the program user wants to work with.
> #Such as:
> digital_input = int(raw_input("What digital (base-10) number do you wish 
> to convert to Roman numerals?))
> I'm not sure how I would program Python to run the actual conversions.
> PS: I'm familiar with Roman numerals, and I know how to do the 
> conversions manually.

More information about the Tutor mailing list