From c93bde24a4620f905be699e516b65992ccf9b0ff Mon Sep 17 00:00:00 2001 From: Teodor Muzychuk Date: Wed, 4 Oct 2023 14:44:48 +0300 Subject: [PATCH] fixed some formulae and functions for week3 git homework --- homework/github_week3/fibonacci.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/homework/github_week3/fibonacci.py b/homework/github_week3/fibonacci.py index 804f1de..f9115df 100644 --- a/homework/github_week3/fibonacci.py +++ b/homework/github_week3/fibonacci.py @@ -19,11 +19,16 @@ def fibonacci_list(n: int) -> typing.List[int]: def fibonacci_single(n: int) -> int: """Returns the nth Fibonacci number""" + return round((power(golden_section_num(), n) - power(-golden_section_reciprocal(), n)) / sqrt(5)) + + +def golden_section_num() -> float: + """Returns the golden section number""" pass -def golden_ratio(n: int) -> float: - """Returns the golden ratio, used in calculations""" +def golden_section_reciprocal() -> float: + """Returns the reciprocal of the golden section number""" pass