about summary refs log tree commit diff
path: root/scripts/fibonacci.py
diff options
context:
space:
mode:
authorMunyoki Kilyungi2025-03-04 15:53:58 +0300
committerMunyoki Kilyungi2025-03-04 15:53:58 +0300
commit732ae882ec2ca5d928fc131437c48d8291579746 (patch)
tree48760b60b52bd6333ce2673dae70de2a169256f8 /scripts/fibonacci.py
parent7e219e78de75e8aefb614cde3034032a91ee7f7b (diff)
downloadgenenetwork3-732ae882ec2ca5d928fc131437c48d8291579746.tar.gz
Revert "feat: Add Python implementation of Fibonacci number calculation".
This reverts commit 280c5e97d21501c03f672ed3576ae3eddfc76420.
Diffstat (limited to 'scripts/fibonacci.py')
-rw-r--r--scripts/fibonacci.py42
1 files changed, 0 insertions, 42 deletions
diff --git a/scripts/fibonacci.py b/scripts/fibonacci.py
deleted file mode 100644
index 0ee6afe..0000000
--- a/scripts/fibonacci.py
+++ /dev/null
@@ -1,42 +0,0 @@
-"""
-This module provides a function to calculate the nth Fibonacci number using an iterative approach.
-"""
-
-def fibonacci(n: int) -> int:
-    """
-    Calculate the nth Fibonacci number.
-
-    The Fibonacci sequence is a series of numbers where each number is the sum of the two preceding ones.
-    Typically starting with 0 and 1.
-
-    Args:
-        n (int): The position in the Fibonacci sequence to calculate. Must be a non-negative integer.
-
-    Returns:
-        int: The nth Fibonacci number.
-
-    Raises:
-        ValueError: If n is not a non-negative integer.
-    """
-    if not isinstance(n, int):
-        raise ValueError("Input must be an integer.")
-    if n < 0:
-        raise ValueError("Input must be a non-negative integer.")
-    if n == 0:
-        return 0
-    elif n == 1:
-        return 1
-
-    a, b = 0, 1
-    for _ in range(2, n + 1):
-        a, b = b, a + b
-    return b
-
-if __name__ == "__main__":
-    # Example usage:
-    try:
-        position = 10
-        result = fibonacci(position)
-        print(f"The {position}th Fibonacci number is: {result}")
-    except ValueError as e:
-        print(f"Error: {e}")