Skip to content

Comments

Add age_controller.py with validate_age function (issue #12809)#13638

Closed
Tejasrahane wants to merge 4 commits intoTheAlgorithms:masterfrom
Tejasrahane:feature/age-controller
Closed

Add age_controller.py with validate_age function (issue #12809)#13638
Tejasrahane wants to merge 4 commits intoTheAlgorithms:masterfrom
Tejasrahane:feature/age-controller

Conversation

@Tejasrahane
Copy link
Contributor

This PR adds a new age_controller.py module that implements the validate_age function to address issue #12809.

Summary:
The age_controller.py module provides robust age validation functionality that:

  • Accepts age input as int, str, or float
  • Validates that the age is a positive integer within a reasonable range (0-150 years)
  • Includes comprehensive error handling for invalid inputs
  • Features complete doctests demonstrating various use cases
  • Follows all Python type hints and naming conventions

The implementation handles edge cases including negative numbers, out-of-range values, and invalid string inputs.

Describe your change:

  • Add an algorithm?
  • Fix a bug or typo in an existing algorithm?
  • Add or change doctests? -- Note: Please avoid changing both code and tests in a single pull request.
  • Documentation change?

Checklist:

  • I have read CONTRIBUTING.md.
  • This pull request is all my own work -- I have not plagiarized.
  • I know that pull requests will not be merged if they fail the automated tests.
  • This PR only changes one algorithm file. To ease review, please open separate PRs for separate algorithms.
  • All new Python files are placed inside an existing directory.
  • All filenames are in all lowercase characters with no spaces or dashes.
  • All functions and variable names follow Python naming conventions.
  • All function parameters and return values are annotated with Python type hints.
  • All functions have doctests that pass the automated testing.
  • All new algorithms include at least one URL that points to Wikipedia or another similar explanation.
  • If this pull request resolves one or more open issues then the description above includes the issue number(s) with a closing keyword: "Fixes Need help for my age controller #12809".

Fixes #12809

Tejasrahane and others added 3 commits October 21, 2025 07:35
…#12809)

This module validates and processes age input, ensuring it is a positive integer within the range of 0 to 150. It includes error handling for invalid inputs and provides examples in the docstring.
@algorithms-keeper algorithms-keeper bot added the awaiting reviews This PR is ready to be reviewed label Oct 21, 2025
@algorithms-keeper algorithms-keeper bot added the tests are failing Do not merge until tests pass label Oct 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting reviews This PR is ready to be reviewed tests are failing Do not merge until tests pass

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Need help for my age controller

1 participant