Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

python halp

Name: Anonymous 2008-02-28 1:39

Quick question /prog/,
I'm just starting out a course at school involving python, and this is the first programming language I have had experience in. I have an exercise asking me to predict the output of expression

int (-8.0 / 3)

and i thought -3 since -8.0/3 = -2.666.. and the integer floors it to -3, but the output is -2. I tried -8/3 integer division and it gives -3.

tl;dr why does
int(-8.0/3) = -2
but
-8/3 = -3

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List