anonymous
  • anonymous
so iv just started the prime number challenge, please help, basically, im having trouble giving python a command, her is a simple version of the line while x%y == >0: this gives me syntax error, im trying to say that, if x/y leaves a remainder, then x=x-1, if not, a+1 and repeat where a is the number being tested.... if that makes any sense? lol
MIT 6.00 Intro Computer Science (OCW)
  • Stacey Warren - Expert brainly.com
Hey! We 've verified this expert answer for you, click below to unlock the details :)
SOLVED
At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.
chestercat
  • chestercat
I got my questions answered at brainly.com in under 10 minutes. Go to brainly.com now for free help!
anonymous
  • anonymous
Hi if you want know the simplest way to solve the prime number .. here is the way. you dont need to check the whole number ,,,just start the for loop from two till you arrive to the half of the number that you are attempting to know if it is prime or not. here is the example of what i say ... for(int i=2;x/2;i++) if(x%i==0) it is not prime ; else it is prime.
anonymous
  • anonymous
you just need if x % y > 0 not ==
anonymous
  • anonymous
pmpn8ez is right, but didn't explain what is wrong with your statement. == and > are both comparison operations, so you're getting an error. Section 5.3 of the Python documentation can expand on this if you're interested. http://docs.python.org/library/stdtypes.html Hope this helps!

Looking for something else?

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

More answers

anonymous
  • anonymous
hey, thanks to you both, i sorted it and you were both a big help, if you wouldn't mind taking a look at my new thread about 1b? would reallt be of help, thanks

Looking for something else?

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