Hi,

I wrote a little program that does the conversion (I won't post it because it 
would be a spoiler for the OP). The one thing I don't know, though, is how to 
formalise
that it is not allowed to write something like IIIIIIIIX, but instead just II. 
Or not DM but simply D. The rule is to write it the shortest possible way. Am I 
wrong or is it really not trivial at all to write an error class for such 
lengthy roman numerals?

 
Regards,
Albert-Jan


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
All right, but apart from the sanitation, the medicine, education, wine, public 
order, irrigation, roads, a 
fresh water system, and public health, what have the Romans ever done for us?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 


>________________________________
> From: Alan Gauld <alan.ga...@btinternet.com>
>To: tutor@python.org 
>Sent: Monday, February 27, 2012 4:37 PM
>Subject: Re: [Tutor] roman to arabic
> 
>On 27/02/12 14:41, Cranky Frankie wrote:
>
>> <<A quote worth mentioning here is:  "If you need more than 3 levels
>> of indentation, you're screwed
>> 
>> I've always wondered about this quote. I'm thinking it means you might
>> want to have functions or subroutines, depending on the language, to
>> do big chunks of logic,
>
>That's one option.
>
>The OP also had the option of using a lookup table(dictionary)
>or just using elifs instead of nested ifs.
>
>Often a different algorithm helps.
>
>Also functional programming (ie. not just procedural!) can reduce the numbers 
>of indentation levels. (See the FP topic in my tutor for some examples of 
>this.)
>
>Simple hiding of indentation levels inside a function is kind of
>the last resort in reducing indentation levels. Generally deep indentation 
>reveals problems in the basic algorithm and/or
>data structures.
>
>> offers almost unlimited indentation, so it's up to the programmer to
>> not use it?
>
>Correct, this is a program design decision not a language feature.
>
>-- Alan G
>Author of the Learn to Program web site
>http://www.alan-g.me.uk/
>
>_______________________________________________
>Tutor maillist  -  Tutor@python.org
>To unsubscribe or change subscription options:
>http://mail.python.org/mailman/listinfo/tutor
>
>
>
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to