A community for students.

Here's the question you clicked on:

55 members online
  • 0 replying
  • 0 viewing

anonymous

  • 5 years ago

Where did you all find your info in the lectures and reading for coming up with the answer for PS1. I've been through it numerous times and I'm not getting it. Thanks.

  • This Question is Closed
  1. anonymous
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    The syntax necessary is in the lecture and readings but the logic behind what to do isn't. You kind of just have to figure that part out.

  2. anonymous
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    If you give me what you have so far I may be able to help you.

  3. anonymous
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    Ahh, I see. I was wondering that. I really wanted to try and figure it out by myself but I'm not getting there. I know what I need the program to do but its the entering it in that's my obstacle. For example, where can I find out what Python's 29 generators (key words) all do? I'm also not totally familiar with the modulus concept and what it's purpose is.

  4. anonymous
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    modulus basically means remainder. % is the symbol for modulus so if you do 10%3 your answer will be one because 10/3 leaves a remainder of 1. It is very useful in telling if a number is even because if you take a number%2 and the answer is 0 then there was no remainder therefor it is even.**** It is also very useful in telling if a number is divisible by another ****(USEFULL FOR PSET1). look back at what the other guy that helped you said about assuming that a number is prime and prove that it is not. Put together my stared sentence and his explanation and you should be able to figure it out. If not keep asking questions...I have school but I check openstudy a good 3 to 4x a day. You don't need to jump into learning all 29 keywords just yet they will just confuse you because you may no what they mean but you wont know the good uses for them.

  5. anonymous
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    Here's a script that contains examples for all the tools you'll need for solving ps1a. Hope it helps!

    1 Attachment
  6. anonymous
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    Thanks! 10/3 leaves a remainder of one? 10/3 = 3.33333333333333. Can you explain this remainder concept a bit more? I also watched lecture 3, something I didn't do before, I hope it helps me. Thanks again!

  7. anonymous
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    10/3 if you do int division (don't go into decimal )it leaves a remainder of 1. integer division 10/3=3 but 3*3 is only 9 so 10/3 = 3 with a remainder 1 because 9 is one less than 10. Sorry I don't know how else to explain it if anyone can explain this better please do. Here is the book explanation http://www.greenteapress.com/thinkpython/thinkCSpy/html/chap04.html If you still don't understand. Let me know I will try and explain better.

  8. anonymous
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    Thanks for the try, I'm still not following. I've poured over internet results on what modulus but no one seems to explain how the remainder comes to be. Wikipedia isn't helping me either.

  9. anonymous
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    Ok for explanation sake lets say you have 10 books which you want to divide evenly among 3 friends(which is 10/3). You would give each person 3 books and there would be 1 left over(the remainder) that you can't give to any, one person because it would make one person have more than the other two. So 10/3 would be 3 Remainder 1 because you can give 3 evenly and then you will have 1 left over. here is a link with explanations similar to this http://www.homeschoolmath.net/teaching/md/not_exact_division.php if this doesn't help either I will try to find another way to explain it.

  10. anonymous
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    Maybe this will help clarify 10%3: 10-3=7 7-3= 4 4-3=1

  11. anonymous
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    Hi Onyx, that makes sense. Thanks. I wondered about that but all the info I read didn't put in those terms. So how does this work if you did 3%10?

  12. anonymous
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    3 is already less than 10, so you'd get 3

  13. anonymous
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    The remainder would just be 3 because you don't have enough to divide it out to lets say 10 people.

  14. anonymous
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    So 5%25 is 5, 35%3992 is 35, etc...?

  15. anonymous
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    yes

  16. anonymous
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    perfect

  17. anonymous
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    Glad I could help is that all or do you have anymore questions?

  18. anonymous
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    So with regards to PS1, if the modulus operator tells me if a number is even or odd, and I know that all odd integers are a place to start for being prime candidates, I should probably begin here...right? I want my program to only work with odd numbers. Then I want to build a command that tests if the odd number is prime. Then I want build a command that counts how many primes there are until I get to the 1000th prime. It's putting it into programming language that's the hardest for me at this point and the occasional math concept like modulo.

  19. anonymous
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    Yea that's a good place to start. What I'm about to say may not be proper technique but whatever just start out by putting what you know in to the code even if the code doesn't run or make sense. Usually from this point I can problem solve and see what I need to do to make it work. The proper way to do it is to write it out in words or a flow chart and then convert it into python syntax. When you write it out in words you have a guideline basically for your code which can be very helpful.

  20. anonymous
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    by put in what you know I mean like any assignment variables such as count to count how many primes you get or any assignments, In the lectures you have learned so far have you learned loops?

  21. anonymous
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    in the lectures you have watched so far.**correction**

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

    • Attachments:

Ask your own question

Sign Up
Find more explanations on OpenStudy
Privacy Policy

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
  • 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.

This is the testimonial you wrote.
You haven't written a testimonial for Owlfred.