Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #8051

Re: Boolean result of divmod

From Terry Reedy <tjreedy@udel.edu>
Subject Re: Boolean result of divmod
Date 2011-06-20 21:35 -0400
References <261fc85a-ca6b-4520-93ed-27e78bc217fc@y30g2000yqb.googlegroups.com>
Newsgroups comp.lang.python
Message-ID <mailman.207.1308620128.1164.python-list@python.org> (permalink)

Show all headers | View raw


On 6/20/2011 8:28 PM, Gnarlodious wrote:
> What is the easiest way to get the first number as boolean?
>
> divmod(99.6, 30.1)
>
> Or do I have to say:
>
> flote, rem=divmod(99.6, 30.1)
> bool(flote)

divmod(x,y) == x//y, x%y

so bool(x//y)

-- 
Terry Jan Reedy

Back to comp.lang.python | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

Boolean result of divmod Gnarlodious <gnarlodious@gmail.com> - 2011-06-20 17:28 -0700
  Re: Boolean result of divmod Chris Torek <nospam@torek.net> - 2011-06-21 00:38 +0000
  Re: Boolean result of divmod MRAB <python@mrabarnett.plus.com> - 2011-06-21 01:45 +0100
  Re: Boolean result of divmod Terry Reedy <tjreedy@udel.edu> - 2011-06-20 21:35 -0400

csiph-web