A community for students.
Here's the question you clicked on:
 0 viewing
anonymous
 5 years ago
I'm working on PS1a. While I have a general understanding of what I need to do, I'm a little lost as far as beginning my code.
My first thought was to define what a prime number is in Python. I was thinking along the lines of something like:
pn= a/a == 1 and a/1 == a
These would be the two rules for primes: divisible only by 1 and itself.
I'm stuck on getting the proper code going though.
Can someone point me in the right direction? Also, is there a reference sheet explaining what Python key words, commands, etc all do?
Thanks!
anonymous
 5 years ago
I'm working on PS1a. While I have a general understanding of what I need to do, I'm a little lost as far as beginning my code. My first thought was to define what a prime number is in Python. I was thinking along the lines of something like: pn= a/a == 1 and a/1 == a These would be the two rules for primes: divisible only by 1 and itself. I'm stuck on getting the proper code going though. Can someone point me in the right direction? Also, is there a reference sheet explaining what Python key words, commands, etc all do? Thanks!

This Question is Closed

anonymous
 5 years ago
Best ResponseYou've already chosen the best response.0Rather than focusing on what a prime number is, it may help to focus on what a prime number isn't. I realize that it sounds kind of funny. What I mean is, assume that the number is prime, then try to disprove the assumption. Hopefully I can explain: For example, try getting a list of numbers together and checking to see if there are any numbers (you only need to check numbers less than the candidate) that will divide with a remainder of 0. If so, they are not prime numbers. If you exhaust checking what a prime number isn't, then you know you have a prime number. I hope I didn't just confuse you more. Anyway, I find the official Python documentation very useful: http://docs.python.org/index.html.

anonymous
 5 years ago
Best ResponseYou've already chosen the best response.0That kind of helps. A big link I'm missing is that from lectures 12 and the reading, I'm not understanding how I'm supposed to come up with a program that does this. The lectures are kind of vague and leave lots of holes to be filled for me. Can you send me that link again? I can't get it to open. Thanks!

anonymous
 5 years ago
Best ResponseYou've already chosen the best response.0Sorry, a period got pulled into the link last time: http://docs.python.org/index.html
Ask your own question
Sign UpFind more explanations on OpenStudy
Your question is ready. Sign up for free to start getting answers.
spraguer
(Moderator)
5
→ View Detailed Profile
is replying to Can someone tell me what button the professor is hitting...
23
 Teamwork 19 Teammate
 Problem Solving 19 Hero
 Engagement 19 Mad Hatter
 You have blocked this person.
 ✔ You're a fan Checking fan status...
Thanks for being so helpful in mathematics. If you are getting quality help, make sure you spread the word about OpenStudy.