Question: Please fix my code: num _ primes = int ( input ( How many primes: ) ) num _ factors = 0 prime

Please fix my code: num_primes = int(input("How many primes: "))
num_factors =0
prime_count =0
prime_candidate =2
while prime_count < num_primes:
for potential_factor in range(2, prime_candidate):
if prime_candidate%potential_factor ==0:
num_factors = num_factors +1
if num_factors ==0:
print(str(potential_factor))
prime_candidate = prime_candidate +1

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!