mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-02-25 02:18:39 +00:00
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
This commit is contained in:
parent
c18681669a
commit
0f193400e1
@ -2,6 +2,7 @@ from __future__ import annotations
|
||||
from math import ceil, sqrt
|
||||
import time
|
||||
|
||||
|
||||
def timer(func):
|
||||
def wrapper(*args, **kwargs):
|
||||
start = time.time()
|
||||
@ -10,8 +11,10 @@ def timer(func):
|
||||
end = time.time()
|
||||
print(f"{func.__name__} took {end - start:.6f} seconds to execute.")
|
||||
return result
|
||||
|
||||
return wrapper
|
||||
|
||||
|
||||
@timer
|
||||
def prime_factors(n: int) -> list[int]:
|
||||
"""
|
||||
@ -60,6 +63,7 @@ def prime_factors(n: int) -> list[int]:
|
||||
factors.append(n)
|
||||
return factors
|
||||
|
||||
|
||||
@timer
|
||||
def primeproduct(num: int) -> list[int]:
|
||||
"""
|
||||
@ -110,7 +114,8 @@ def primeproduct(num: int) -> list[int]:
|
||||
break
|
||||
return prime_factors
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
n = int(input('enter number: ').strip())
|
||||
n = int(input("enter number: ").strip())
|
||||
primeproduct(n)
|
||||
prime_factors(n)
|
||||
|
Loading…
x
Reference in New Issue
Block a user