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.
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.
If you give me what you have so far I may be able to help you.
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.
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.
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!
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.
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.
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.
Maybe this will help clarify 10%3: 10-3=7 7-3= 4 4-3=1
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?
3 is already less than 10, so you'd get 3
The remainder would just be 3 because you don't have enough to divide it out to lets say 10 people.
So 5%25 is 5, 35%3992 is 35, etc...?
Glad I could help is that all or do you have anymore questions?
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.
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.
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?
in the lectures you have watched so far.**correction**