+ 1

I am having trouble with the % symbol in python can anyone help with these functions .not the greatest at math I suppose

math symbol problem in python

29th May 2017, 5:59 AM
john elifrits
john elifrits - avatar
9 Answers
+ 4
a%b returns the remainder of division of a/b
29th May 2017, 6:04 AM
Vishnu ks
Vishnu ks - avatar
+ 3
7/4 is taken as 1. So it is 1%64 which is 1
29th May 2017, 6:09 AM
Vishnu ks
Vishnu ks - avatar
+ 3
No it is still performing the same operation of giving remainder
29th May 2017, 6:19 AM
Vishnu ks
Vishnu ks - avatar
+ 1
so if % is in an equation 7/4% (8*8) then what is it doing here%
29th May 2017, 6:07 AM
john elifrits
john elifrits - avatar
+ 1
I have same problem when finding an integer which is multiple of six plus one. So I use n%6-1==0 . However the result of 1%6 give me 1 which is wrong. So I use n%6-1==0 and n/6>=1 to solve the problem
29th May 2017, 6:33 AM
hahaha
hahaha - avatar
0
try putting 6-1 in paranthesis here % is having more precedence than +operation that is % is done first when n=1,1%6=1 and then 1-1=0 that's why u r getting result as one
3rd Jun 2017, 9:59 AM
Nandu 1998
Nandu 1998 - avatar
0
n%(6-1) or simply put 5 instead but o/p will be 5
3rd Jun 2017, 10:04 AM
Nandu 1998
Nandu 1998 - avatar
- 1
so in this equation is it multiplying then?
29th May 2017, 6:10 AM
john elifrits
john elifrits - avatar
- 1
what happens to the 64 then does % make the rest of the equation voided
29th May 2017, 6:20 AM
john elifrits
john elifrits - avatar