anonymous
  • anonymous
Hello, I am having difficulty editing my solution for ps1a into a solution for ps1b. I had no problem with the ps1a, but this second part has left me completely clueless.. Any help will be appreciated, thanks.
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
Here's my code for ps1a:
1 Attachment
anonymous
  • anonymous
First what you need to do is add the the command import math to the top of your code then add an assignment named sumOfPrimes=0. Under your if true statement add the command sumOfPrimes=sumOfPrimes+math.log(testInteger). Now depending on through what number of primes you want to add you need to change your number in the while loop.
anonymous
  • anonymous
I believe this is how you do it but I did it wrong the first time I did it because I misread the directions and I didn't want to redo it. So if anyone else has any suggestions please answer back.

Looking for something else?

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

More answers

anonymous
  • anonymous
I added some lines into your script. It should work. If any questions, feel free to ask me. ## Start from here from math import* testInteger = 1 #Number to be tested if prime numberOfPrime = 1 #Number of prime (changes if prime # found) lnproduct=log(2) n=300 while(numberOfPrime
anonymous
  • anonymous
Thanks, I ran that code and it seemed to work great, plus I understand the logic behind each addition. I appreciate the help!

Looking for something else?

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