From 0ecb9fc85084a409079b73738530195a31116f90 Mon Sep 17 00:00:00 2001 From: viktor_pakholok Date: Wed, 4 Oct 2023 17:49:43 +0300 Subject: [PATCH] 3 and 4 functions --- homework/github_week3/fibonacci.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/homework/github_week3/fibonacci.py b/homework/github_week3/fibonacci.py index bf3a00f..9bcf9c1 100644 --- a/homework/github_week3/fibonacci.py +++ b/homework/github_week3/fibonacci.py @@ -17,14 +17,15 @@ def fibonacci_list(n: int) -> typing.List[int]: pass -def fibonacci_single(n: int) -> int: +def fibonacci_single(nomer: int) -> int: + """Returns the nth Fibonacci number""" - pass + return ((golden_section_num()**nomer) - ((-1 * golden_section_reciprocal())**nomer))/(5**(1/2)) def golden_section_num() -> float: """Returns the golden section number (capital Phi)""" - pass + return (5**(1/2) + 1)/2 def golden_section_reciprocal() -> float: