Hi. I'm trying to compare e.g. 25/6 to 25%6 (modular arithmetic?) for the prime problem (2nd assignment i think). My version of python (2.7.3) doesn't seem to know what to do with '%'. e.g. if I do 15%3 it returns 0. Can anyone explain what's happening here? Have I downloaded the wrong version? What command can I use without starting again with 2.5.4? Many thanks :)

Hey! We 've verified this expert answer for you, click below to unlock the details :)

I got my questions answered at brainly.com in under 10 minutes. Go to brainly.com now for free help!

well 15%3 is zero, because 3*5=15 so there is no remainder do you still get zero for 12%5 ???

Okay, I'm clearly missing something major here. I'm looking for a command (operator?) whereby I can do ... 12/5 and get 2.4 (a rational number?) and not 2 (an integer). I gathered from the lectures that '%' was the way to do this but, as you say, this means something else entirely. So two questions - 1. What does '%' do? and 2. How can I get do division and get numbers with decimals? As you can probably tell, maths is not my strong suit :)

well its not so much maths here but the way a programming enviroment sees maths. taking you exsample im going to give you different ways to do the division. 1: 12/5 =2 it is True as what you do is an integer division. 2: 12.0/5.0 = 2.4 this is called a float division. 3. 12%5 =2 but 2 here is NOT the RESULT of an integer division but the REMAINDER of that integer division. eg 10%3=1 because 10/3=3 --> 3*3=9 this means we have a remainder of 10-9=1 hope this helps!:)

Looking for something else?

Not the answer you are looking for? Search for more explanations.

## More answers

Looking for something else?

Not the answer you are looking for? Search for more explanations.