Title: fix-factorial-validation: Fix input validation and doctests by MathewAddala · Pull Request #13818 · TheAlgorithms/Python · GitHub
Open Graph Title: fix-factorial-validation: Fix input validation and doctests by MathewAddala · Pull Request #13818 · TheAlgorithms/Python
X Title: fix-factorial-validation: Fix input validation and doctests by MathewAddala · Pull Request #13818 · TheAlgorithms/Python
Description: Fix factorial() input validation to use isinstance(number, int) instead of value comparison Changes: Replace 'number != int(number)' with 'not isinstance(number, int)' in factorial() Fix doctests in factorial_recursive() to reference factorial_recursive() instead of factorial() Add negative test case for factorial(1.5) to verify non-integer rejection This ensures consistent input validation between factorial() and factorial_recursive() functions. 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 #ISSUE-NUMBER".
Open Graph Description: Fix factorial() input validation to use isinstance(number, int) instead of value comparison Changes: Replace 'number != int(number)' with 'not isinstance(number, int)' in factorial...
X Description: Fix factorial() input validation to use isinstance(number, int) instead of value comparison Changes: Replace 'number != int(number)' with 'not isinstance(number, int)&#...
Opengraph URL: https://github.com/TheAlgorithms/Python/pull/13818
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:83d58cb0-38fa-7f79-26b1-7eb4e74abab3 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | EDBE:269996:4CD2D40:6607787:6A5D9E13 |
| html-safe-nonce | f4fe9508b4d0e43657d84aea1a08ba97df38adced9058d2a0057cfc80fabd707 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFREJFOjI2OTk5Njo0Q0QyRDQwOjY2MDc3ODc6NkE1RDlFMTMiLCJ2aXNpdG9yX2lkIjoiNzQ5ODc3MTM2MDIyOTcyNzc2MyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 9e7a416547c5fda33c89a9793a4db71f37493615a2d40ede54df2becdb608886 |
| hovercard-subject-tag | pull_request:2965301076 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/TheAlgorithms/Python/pull/13818/files |
| twitter:image | https://avatars.githubusercontent.com/u/220877534?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/220877534?s=400&v=4 |
| og:image:alt | Fix factorial() input validation to use isinstance(number, int) instead of value comparison Changes: Replace 'number != int(number)' with 'not isinstance(number, int)' in factorial... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 5290d7e14309ad1e76106a9c4237bd1041517e83ea182c8ab756752cb0c6940b |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/TheAlgorithms/Python git https://github.com/TheAlgorithms/Python.git |
| octolytics-dimension-user_id | 20487725 |
| octolytics-dimension-user_login | TheAlgorithms |
| octolytics-dimension-repository_id | 63476337 |
| octolytics-dimension-repository_nwo | TheAlgorithms/Python |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 63476337 |
| octolytics-dimension-repository_network_root_nwo | TheAlgorithms/Python |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 9c975978430e9ad293956f2bbdaf153b1bd84a99 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width