What I am trying to do is run this program, get the execution time of it, and then continue to do that 9 more times. How would I go about iterating over it to get it to print out 10 different execution times? I'm not quite sure how I need to structure the program in order to accomplish this.
import time
start_time = time.time()
def fibonacci():
previous_num, result = 0, 1
user = 1000
iteration = 10
while len(str(result)) < user:
previous_num, result = result, previous_num + result
while iteration != 0:
iteration -= 1
end = time.time()
print(start_time - end)
return result
print(fibonacci())
print("--- %s seconds ---" % (time.time() - start_time))