Re: [Tutor] roman to arabic

2012-02-27 Thread Albert-Jan Roskam
; From: Evert Rol >To: Albert-Jan Roskam >Cc: Python Tutor >Sent: Monday, February 27, 2012 5:42 PM >Subject: Re: [Tutor] roman to arabic > >> 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 thi

Re: [Tutor] roman to arabic

2012-02-27 Thread Evert Rol
ads, a > fresh water system, and public health, what have the Romans ever done for us? > ~~ > From: Alan Gauld > To: tutor@python.org > Sent: Monday, February 27, 2012 4:37 PM > Subject: Re: [Tutor] roman t

Re: [Tutor] roman to arabic

2012-02-27 Thread Alan Gauld
On 27/02/12 16:28, Albert-Jan Roskam wrote: possible way. Am I wrong or is it really not trivial at all to write an error class for such lengthy roman numerals? Its non trivial, you need something like a state machine to detect valid transitions as you read each character. Alan G.

Re: [Tutor] roman to arabic

2012-02-27 Thread Albert-Jan Roskam
t: Monday, February 27, 2012 4:37 PM >Subject: Re: [Tutor] roman to arabic > >On 27/02/12 14:41, Cranky Frankie wrote: > >> <> of indentation, you're screwed >> >> I've always wondered about this quote. I'm thinking it means you might >> want t

Re: [Tutor] roman to arabic

2012-02-27 Thread Alan Gauld
On 27/02/12 14:41, Cranky Frankie wrote: < 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 indenta

Re: [Tutor] roman to arabic

2012-02-26 Thread bob gailer
On 2/26/2012 6:29 PM, Sukhpreet Sdhu wrote: Hi I just wrote python code to convert roman to arabic numerals [snip] Yuk what a mess. May I suggest you start with a much simpler program, which is to take a roman number between 1 and 3 (just i's) and convert that. First describe how you'd conv

Re: [Tutor] roman to arabic

2012-02-26 Thread Alan Gauld
On 26/02/12 23:29, Sukhpreet Sdhu wrote: import string Are you using a very old versioon opf python? If not you should not use string. The built in string methods can do everything you want without resorting to string. print "Welcome to the numeric conversion program" print "Please enter com

Re: [Tutor] roman to arabic

2012-02-26 Thread Walter Prins
Hi , On 26 February 2012 23:29, Sukhpreet Sdhu wrote: > Hi > I just wrote python code to convert roman to arabic numerals, but its not > working. How exactly is it not working? Please don't make us guess or work more than neccesary trying to help you... > Can you just check where the problem

Re: [Tutor] roman to arabic

2012-02-26 Thread Mark Lawrence
On 26/02/2012 23:29, Sukhpreet Sdhu wrote: Hi I just wrote python code to convert roman to arabic numerals, but its not working. Can you just check where the problem is and way to correct that. So here is my python code import string print "Welcome to the numeric conversion program" print "Pleas