This is a simple Flask application that provides an API to analyze numbers. It checks if a given number is an Armstrong number and a palindrome.
- Python 3.x
- pip (Python package installer)
-
Clone the repository or download the
app.py
file to your local machine. -
Navigate to the directory containing the
app.py
file. -
Install Flask using pip:
pip install Flask
-
Open a terminal or command prompt.
-
Navigate to the directory where your
app.py
file is located. -
Run the Flask application:
python app.py
-
You should see output indicating the Flask development server is running. By default, it will run on
http://127.0.0.1:5000/
.
- URL:
/
- Method: GET
- Description: Returns a welcome message.
Example:
http://127.0.0.1:5000/
Response
My First API
Analyze Number Endpoint
- URL:
/analyze_number/<int:n>
- Method: GET
- Description: Analyzes the given number to check if it is an Armstrong number and a palindrome.
Example:
http://127.0.0.1:5000/analyze_number/153
Response:
{
"number": 153,
"armstrong": true,
"palindrome": false
}