from random import randint
from time import time
arr = [randint(1, 3) for _ in range(1000000)]
arr.append(4)
def profesor08(arr):
counter = dict();
for n in arr:
if str(n) in counter:
counter[str(n)] = counter[str(n)] + 1
else:
counter[str(n)] = 1
for (key, value) in counter.items():
if value == 1:
print(key)
def phaggi(arr):
for i in set(arr):
if arr.count(i) == 1:
print(i)
starttime = time()
profesor08(arr)
firsttime = time() - starttime
starttime = time()
phaggi(arr)
secondtime = time() - starttime
print(f"professor's time:\t{firsttime*100}\nphagocyte's time:\t{secondtime*100}")
500 ms between each lang_detect and 1s between each translation
try:
translate
except Exception:
pass
то оно глотает ошибки и всё.