Question: Find the error in the following python code: import time def current _ milli _ time ( ) : return round ( time . time

Find the error in the following python code:
import time
def current_milli_time():
return round(time.time()*1000)
def is_prime(x):
prime = True
if x ==1:
return False
else:
for i in range(2, x-1):
if (x % i)==0:
prime = False
return prime
rs =1000
re =40000
start = current_milli_time()
for i in range(rs, re):
if is_prime(i):
print(i,"is prime")
end = current_milli_time()
print((re-rs), "numbers searched in", end-start, "milliseconds")

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!