## Re: [Jython-users] Python and Math Question

 Re: [Jython-users] Python and Math Question From: Diez B. Roggisch - 2004-11-22 12:39:53 ```Hi, you want something like this: def quersumme(d): s = 0 while d > 0: d, s = d / 10, d %10 By the way: while jython is great - why don't you use python itself for learning? Diez ```

 [Jython-users] Python and Math Question From: Andrew - 2004-11-22 00:05:43 ```Hi I am having troubles figuring out a math eqausion for a program in Jython that I am writing num = 9 another_num = input() #answer in multiple of 9 #example 9 * 2 = 18 num * another_num = answer now my problem lies in what equasion or (function if there is one) to take the answer and seperate the numbers from left to right example # 18 (1 and 8) 27 (2 and 7) 36 (3 and 6) 108 (1 and 0 and 8) basically so I can add them up to equal 9 again any ideas are appreciated thank you P.S. this is not a school question I am not in school I am just here to learn to program on my own Cheers Andrew ```
 Re: [Jython-users] Python and Math Question From: Greg Hamilton - 2004-11-22 01:05:44 ```Andrew wrote: > Hi I am having troubles figuring out a math eqausion for a program in > Jython that I am writing > > num = 9 > another_num = input() > > #answer in multiple of 9 #example 9 * 2 = 18 > num * another_num = answer > Hmmm, not really sure what you're talking about here. > now my problem lies in what equasion or (function if there is one) > > to take the answer and seperate the numbers from left to right example # > 18 (1 and 8) 27 (2 and 7) 36 (3 and 6) 108 (1 and 0 and 8) > I suppose a list comprehension could solve this problem. eg. digits = [int(e) for e in str(108)] > I am not in school I am just here to learn to program on my own Perhaps you should visit the Python web site. There's a wealth of documentation including a beginner's guide ("start here if you're new to programming"), a very informative tutorial and the invaluable global module index. http://www.python.org http://www.python.org/moin/BeginnersGuide http://docs.python.org/tut/tut.html http://docs.python.org/modindex.html ```
 [Jython-users] Lazlo Imagemap equivalent? From: Craig Smith - 2004-12-06 19:42:06 ```Hi: Is there a Lazlo component somewhere that is roughly equivalent to an html client side imagemap? That is, I want to show a bitmap and have a set of invisible, arbitrarily shaped, polygons that overlay it and when you click in one of those polygons an action is executed. There's such a rich set of components available I feel like I'm missing something obvious. Or do I just need to delve further into lzx and make my own? Thanks so much. -Craig Smith ```
 Re: [Jython-users] Sorry wrong list. Lazlo Imagemap equivalent? From: Craig Smith - 2004-12-06 19:52:28 ``` Drat, drat, drat. Sorry, I sent this to entirely the wrong list. My apologies. -C p.s. Although if anyone knows of an imagemap component in Lazlo, please let me know :-) ----- Original Message ----- From: "Craig Smith" To: Sent: Monday, December 06, 2004 11:41 AM Subject: [Jython-users] Lazlo Imagemap equivalent? > Hi: > > Is there a Lazlo component somewhere that is roughly equivalent to an > html client side imagemap? That is, I want to show a bitmap and have a set > of invisible, arbitrarily shaped, polygons that overlay it and when you > click in one of those polygons an action is executed. There's such a rich > set of components available I feel like I'm missing something obvious. Or > do I just need to delve further into lzx and make my own? > Thanks so much. > > -Craig Smith > > > > ------------------------------------------------------- > SF email is sponsored by - The IT Product Guide > Read honest & candid reviews on hundreds of IT Products from real users. > Discover which products truly live up to the hype. Start reading now. > http://productguide.itmanagersjournal.com/ > _______________________________________________ > Jython-users mailing list > Jython-users@... > https://lists.sourceforge.net/lists/listinfo/jython-users ```
 Re: [Jython-users] Python and Math Question From: Diez B. Roggisch - 2004-11-22 12:39:53 ```Hi, you want something like this: def quersumme(d): s = 0 while d > 0: d, s = d / 10, d %10 By the way: while jython is great - why don't you use python itself for learning? Diez ```
 Re: [Jython-users] Python and Math Question From: Diez B. Roggisch - 2004-11-22 13:49:26 ```> def quersumme(d): > s = 0 > while d > 0: > d, s = d / 10, d %10 Should have reread the post before - quersumme has to look like this of course: def quersumme(d): s = 0 while d > 0: d, s = d / 10, s + d %10 return s Diez ```
 Re: [Jython-users] Python and Math Question From: Andrew - 2004-11-22 15:33:28 ```Hey thanks Greg and Diez for replying so quickly I am starting to think my question is not possible Although your answers both seem to work in there respect its not what I am trying to achieve at least to my current level of knowledge But thank you I think this is one I have to solve on my own Cheers Andrew ```
 Re: [Jython-users] Python and Math Question From: Bryan - 2004-11-22 00:42:21 ```Andrew wrote: > Hi I am having troubles figuring out a math eqausion for a program in > Jython that I am writing > > num = 9 > another_num = input() > > #answer in multiple of 9 #example 9 * 2 = 18 > num * another_num = answer > > now my problem lies in what equasion or (function if there is one) > > to take the answer and seperate the numbers from left to right example > # 18 (1 and 8) 27 (2 and 7) 36 (3 and 6) 108 (1 and 0 and 8) > > basically so I can add them up to equal 9 again > > any ideas are appreciated thank you > > P.S. > this is not a school question > > I am not in school I am just here to learn to program on my own > > Cheers Andrew > > without giving you all the answers, here's some hints: there is a builtin str function that will accept an int and return a string. there is also a builtin int function that will take an string (in number form) and return a int. for example: >>> str(10) '10' >>> int('10') 10 you can index through a string to retrieve an individual character: >>> a = 'abc' >>> a[0] 'a' >>> a[1] 'b' >>> a[2] if you are asking for help for type of a problem, i would suggest you read a beginning book on python. i found that beginners with almost no programming background find " *Python: Visual QuickStart Guide*" (http://www.bookpool.com/.x/6o2dkqosg4/sm/0201748843) a good first book since it explains everything in an interactive way. your public library should carry this too. bryan ```