Newbie help re Modulus

This is the place for queries that don't fit in any of the other categories.

Newbie help re Modulus

Postby Rubberducky » Sat Jan 25, 2014 9:18 pm

Im just working my way through a beginners python book but im a little confused. The book says modulus will divide two numbers together and return the remainder. The example in the book is 8 % 6 = 2. If i divide 8 by 6 on a calculator however i get 1.33333* How does this end up as 2? :?:
Last edited by Yoriz on Sat Jan 25, 2014 9:35 pm, edited 1 time in total.
Reason: First post lock
Rubberducky
 
Posts: 2
Joined: Sat Jan 25, 2014 9:14 pm

Re: Newbie help re Modulus

Postby stranac » Sat Jan 25, 2014 9:37 pm

It's integer division. 8 / 6 is 1, and the remainder is 2.
Friendship is magic!

R.I.P. Tracy M. You will be missed.
User avatar
stranac
 
Posts: 1218
Joined: Thu Feb 07, 2013 3:42 pm

Re: Newbie help re Modulus

Postby Rubberducky » Sat Jan 25, 2014 9:42 pm

Aaaah, of course, well that clears that up. :D Thanks!
Rubberducky
 
Posts: 2
Joined: Sat Jan 25, 2014 9:14 pm


Return to General Coding Help

Who is online

Users browsing this forum: No registered users and 5 guests