Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import random, time
- def main():
- x = range(10000)
- for i in range(5):
- rem = random.randint(0, 9999)
- if rem in x:
- print("removing %s" %rem)
- x.remove(rem)
- else:
- i+=1
- i = 1
- while True:
- if i in x:
- i += 1
- else:
- break
- return i
- if __name__ == "__main__":
- times = []
- for i in range(1000):
- start = time.time()
- lowest_missing = main()
- end = time.time() - start
- times.append(end)
- print("Found the lowest missing value as %s in %ss" %(lowest_missing,end))
- avarage = reduce(lambda x, y: x + y, times) / float(len(times))
- print("avarage time: %s" %avarage)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement