Skip to content

Add fibonacci function with edge case handling #1

Description

@gougousongsong

Task Description

Implement a function to calculate Fibonacci numbers.

Requirements

  • Function name: fibonacci(n)
  • Should be added to src/math_utils.py
  • Return the nth Fibonacci number (0-indexed)
  • Important: Handle edge case - if n < 0, should raise ValueError with message "n must be non-negative"
  • Add comprehensive tests to tests/test_math_utils.py

Expected Behavior

fibonacci(0) -> 0
fibonacci(1) -> 1
fibonacci(5) -> 5
fibonacci(10) -> 55
fibonacci(-1) -> raises ValueError

Test Requirements

  • Test normal cases (0, 1, 5, 10)
  • Test edge case (negative input must raise ValueError)
  • All existing tests must continue to pass

Labels

  • good-first-issue
  • bounty ($50)

Note: This is a test issue for ABK autonomous coding validation.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions