Skip to content

Ostap top #83

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 27 additions & 8 deletions homework/github_week3/fibonacci.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,28 @@
and functionally decomposes the calculations.
Fill in all the missing code in the functions and in main
"""
import math
import typing
import math


<<<<<<< HEAD
def get_input() -> int:
"""Gets input from the user and returns it as an integer"""
pass
=======
def get_input(inputed) -> int:
>>>>>>> a3b976e3f0d4f1c701bb1e9334ad344c0d871413
return int(input())


def fibonacci_list(n: int) -> typing.List[int]:
"""Returns a list of the first n Fibonacci numbers"""
pass
if isinstance(n, int):
fib_sequence = [1, 2]
for i in range(n-2):
add = fib_sequence[i] + fib_sequence[i + 1]
fib_sequence.append(add)
return fib_sequence


def fibonacci_single(n: int) -> int:
Expand All @@ -23,23 +35,30 @@ def fibonacci_single(n: int) -> int:


def golden_section_num() -> float:
"""Returns the golden section number (capital Phi)"""
pass
"""
Returns the golden section number (capital Phi)
"""

return (1 + math.sqrt(5)) / 2


def golden_section_reciprocal() -> float:
"""Returns the reciprocal of the golden section number (lowercase phi)"""
pass
"""
Returns the reciprocal of the golden section number (lowercase phi)
"""
return (1 - math.sqrt(5)) / 2


def power(num: int, n: int) -> int:
"""Raises num to the nth power"""
pass
result = math.pow(num, n)
return result


def sqrt(num: int) -> float:
"""Returns the square root of num"""
pass
result = math.sqrt(num)
return result


def main():
Expand Down