Boolean result of divmod

G

Gnarlodious

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)

-- Gnarlie
 
C

Chris Torek

M

MRAB

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 returns a tuple, so:

bool(divmod(99.6, 30.1)[0])
 
T

Terry Reedy

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)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top