# division

kpop snag at jool.po
Mon Jun 23 17:00:30 CEST 2003

```"Ben Finney" <bignose-hates-spam at and-zip-does-too.com.au> wrote in message
news:slrnbfcsbv.gfb.bignose-hates-spam at iris.polar.local...
> On Mon, 23 Jun 2003 03:41:28 +0100, kpop wrote:
> > thanks for the help, I think i will change all the numbers to floating
> > points then do the eval
> > and if the result is not a float that end with..0
>
> Rather than using string processing (slow, difficult to understand,
> prone to error), use modulus to find the remainder (fast, obvious,
> built-in):
>
>     remainder = ( result % 1.0 )
>     if( remainder > 0.0 ):
>         raise SomeExceptionYouCreatedForThePurpose
>
> > i will inform the user they typed something wrong
>
> I think your program design needs re-thinking.  If I typed "4 / 3" into
> an arithmetic evaluator, and was told that was an error, I'd certainly
> consider it a design bug in the program.
>
> Can you explain more fully what it is you want to do?  Why do you
> consider a fractional result to be an error?

sure
In the uk there is a tv quiz show called countdown, maybe its on in other
countries too.
theres a game in that where your given six numbers and a target and you have
to get as
close to that target as you can using only the six numbers, you can add them
multiply them
subtract them etc. Im nearly sure its against the rules to divide a number
that doesnt go evenly
like 6/ 2 = 3 is okay but 6/4 = 1 is against the rules. So im trying to
write the game in python.

I knows it not a very important program and its not going to change the way
we use computers or
anything, but im writing it just for fun , to play it with my friends and to
have it as my first python project
to help me learn how to program. I was able to write the letters game easily
enough .Im finding the numbers
game more tricky :)

>
> --
>  \       "It's easy to play any musical instrument: all you have to do |
>   `\       is touch the right key at the right time and the instrument |
> _o__)                     will play itself."  -- Johann Sebastian Bach |
> http://bignose.squidly.org/ 9CFE12B0 791A4267 887F520C B7AC2E51 BD41714B

```