Last active
November 8, 2024 15:09
-
-
Save eduardogpg/c39e648cf4f8643924fda27b3b7361b3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from threading import Thread | |
import time | |
def fib(number): | |
if number <= 1: | |
return number | |
return fib(number - 1) + fib(number - 2) | |
if __name__ == '__main__': | |
start = time.time() | |
threads = [] | |
for _ in range(1): | |
t = Thread(target=fib, args=(35,)) | |
t.start() | |
threads.append(t) | |
for t in threads: | |
t.join() | |
end = time.time() | |
print(f"Time taken: {end - start}") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment