I'm having trouble with problem 2 in problem set 1.so far i did this & getting an error:: from math import * count = 0 i = 1 limitnum = raw_input('Enter the limit of the range') for i in range(2,limitnum): if limitnum/i == 0: break; else: count= count+ log(i+1) i = i + 1 print log(i)

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.

Get our expert's

answer on brainly

SEE EXPERT ANSWER

Get your free account and access expert answers to this and thousands of other questions.

A community for students.

I'm having trouble with problem 2 in problem set 1.so far i did this & getting an error:: from math import * count = 0 i = 1 limitnum = raw_input('Enter the limit of the range') for i in range(2,limitnum): if limitnum/i == 0: break; else: count= count+ log(i+1) i = i + 1 print log(i)

MIT 6.00 Intro Computer Science (OCW)
See more answers at brainly.com
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.

Get this expert

answer on brainly

SEE EXPERT ANSWER

Get your free account and access expert answers to this and thousands of other questions

You probably want to use % (modulo), not / (integer division) For example: 13 / 5 = 2 and 13 % 5 = 3
Were you able to solve Problem 1 successfully? If so, please post the code. Problem 2 builds on Problem 1 and requires only a slight modification.
problem 1: prime = 0 number = 1 while prime < 1000: number = number + 1 # starting from 2 # testing if the number is prime or not divisor = 2 numberIsPrime = True while divisor*divisor <= number: if number % divisor == 0: numberIsPrime = False break divisor = divisor + 1 # found one? if numberIsPrime: prime = prime + 1 print number

Not the answer you are looking for?

Search for more explanations.

Ask your own question

Other answers:

problem 2 is giving an error:File "C:\Python25\ps1b.py", line 11, in for i in range(2,limitnum): TypeError: range() integer end argument expected, got str. still can't slove.
@maitre_kaio:thanx for highlighting the logical error,but i think it's giving me a syntax error.isn't it??i have post it above.

Not the answer you are looking for?

Search for more explanations.

Ask your own question