Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/MojoLlama/blob/main/fibonacci.py # MojoLlama Archived Mojo/MAX quantizer and serving research repository (read-only history) Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `MojoLlama / fibonacci.py` 18 lines ยท 458 bytes Raw Blame History 1 def fibonacci(n: int) -> int: 2 """Return the nth Fibonacci number using iterative approach. 3 4 Args: 5 n: The position in the Fibonacci sequence (0-indexed). 6 7 Returns: 8 The nth Fibonacci number where fibonacci(0) = 0, fibonacci(1) = 1. 9 10 Raises: 11 ValueError: If n is negative. 12 """ 13 if n < 0: 14 raise ValueError("n must be non-negative") 15 a, b = 0, 1 16 for _ in range(n): 17 a, b = b, a + b 18 return a