mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-07-05 01:09:40 +08:00
from __future__ import annotations (#2464)
* from __future__ import annotations * fixup! from __future__ import annotations * fixup! from __future__ import annotations * fixup! Format Python code with psf/black push Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
This commit is contained in:
@ -4,8 +4,9 @@
|
||||
This program calculates the nth Fibonacci number in O(log(n)).
|
||||
It's possible to calculate F(1_000_000) in less than a second.
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
import sys
|
||||
from typing import Tuple
|
||||
|
||||
|
||||
def fibonacci(n: int) -> int:
|
||||
@ -20,7 +21,7 @@ def fibonacci(n: int) -> int:
|
||||
|
||||
|
||||
# returns (F(n), F(n-1))
|
||||
def _fib(n: int) -> Tuple[int, int]:
|
||||
def _fib(n: int) -> tuple[int, int]:
|
||||
if n == 0: # (F(0), F(1))
|
||||
return (0, 1)
|
||||
|
||||
|
Reference in New Issue
Block a user