- #1

- 101

- 0

>>>-17/10

-2

i do not understand this explain pls

NOT A HW

You are using an out of date browser. It may not display this or other websites correctly.

You should upgrade or use an alternative browser.

You should upgrade or use an alternative browser.

- #1

- 101

- 0

>>>-17/10

-2

i do not understand this explain pls

NOT A HW

- #2

Mentor

- 37,231

- 9,396

It's probably a bit easier to understand if both numbers involved are positive. For example, 17/10 evaluates to 1. If you do the long division, you'll see that the quotient is 1 and the remainder is 7, which you can find by evaluating the expression 17 % 10.

With -17/10, it would seem reasonable that the quotient would be -1, but this would result in a remainder of -7. Python seems to like the remainders to be positive, and for this problem gives a remainder of + 3. I.e., -17/10 == 3. This means that -17/10 == -2 plus a remainder of 3. To check this, note that -17 = -2 * 10 + 3.

Hope this helps.

Share:

- Replies
- 6

- Views
- 690

- Replies
- 2

- Views
- 150

- Replies
- 3

- Views
- 591

- Replies
- 1

- Views
- 913

- Replies
- 2

- Views
- 666

- Replies
- 10

- Views
- 1K

- Replies
- 2

- Views
- 500

- Replies
- 1

- Views
- 471

- Replies
- 0

- Views
- 496

- Replies
- 24

- Views
- 1K