[Tutor] The whole Roman to Dec and vice versa issue

Jaggo jaggojaggo at yahoo.com
Sun Mar 11 15:33:44 CET 2007

I'm a rather new programmer, but it seems to me the digital to roman should be coded:
While Digital_Input > 0:
If Digital_Input > 1000 then: Roman = + M, Digital_Input = - 1000
elif Digital_Input > 900 then: Roman = + C, Digital_Input = - 900
Now if someone could please clarify [or forward me to clarifications of-] separation of data from logics I should be very grateful.

[Come to that, if someone could point me to a *simple* gui which I can use in python, keep in mind I did learn a little VB, I should be grateful as well.]

Thank you.
Omer Tabach.

Quoting Bob Gailer :

>> Digital to Roman pseudocode:
>> 1. if digital_input is greater than 1000:
>> subtract 1000 from it and add "M" to string roman_result
>> # How do you do that, add one character to the end of an existing string?
> Start with an empty string:
> roman_result = ""
> To add a character at the end:
> roman_result += "M" # Python shorthand for roman_result = roman_result + "M"
roman_result + "M" would also work, right/ I'm just trying to save  
time on typing in the code, right
>> # also, how do I modify the digital_input variable (it's an integer)
> digital_input -= 1000

is that somewhat like digital_result = digital result - int(1000)?

>> several times through the conversion process?
> You will be processing the input in a loop (while or for).

running = True and
while running

is how I've tended to set

(my pseudocode)

> As you gain familiarity with Python you will develop ways to separate
> data from logic. I might say more about this later, but right now I'm
> about to drive north a bit.
I have already gained some familiary with separating data manipulation  
(data and logic, as a whole) from the code for the user interface,  
that's something that oen of my advisors has been big on.

Now that's room service! Choose from over 150,000 hotels 
in 45,000 destinations on Yahoo! Travel to find your fit.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20070311/beb059b4/attachment.htm 

More information about the Tutor mailing list