A comprehensive tool for practicing Python technical interview questions with dual interfaces: modern web API and interactive CLI flashcard game.
- 🌐 Modern Web Interface: Beautiful, responsive web application with Tailwind CSS
- 🎮 Interactive CLI Game: Flashcard-style practice with progress tracking
- 📊 Comprehensive Statistics: Track performance across categories and difficulties
- 🔍 Multiple Practice Modes: Random, category-based, and difficulty-based filtering
- 💡 Progressive Hints: Get helpful hints before viewing solutions
- 📚 Rich Question Database: 6+ LeetCode problems with detailed solutions
- 🚀 RESTful API: Full CRUD operations for programmatic access
- ✅ Comprehensive Testing: 30+ unit tests covering all functionality
.
├── app.py # Flask web application
├── flashcard_game.py # CLI flashcard game interface
├── game.py # Game logic and statistics
├── questions.py # Question database (6+ LeetCode problems)
├── cli.py # Simple CLI interface
├── main.py # Core algorithmic functions
├── templates/ # Web interface templates
├── static/ # CSS and static files
├── test_app.py # Web API tests
├── test_main.py # Algorithm tests
├── test_cli.py # CLI tests
└── README.md # This file
- Python 3.7 or higher
- pip (Python package manager)
Install the required dependencies:
# For Ubuntu/Debian systems
sudo apt install python3-flask python3-pytest
# For other systems or to install flask-cors
pip3 install flask flask-cors pytest --user --break-system-packages
Or install from requirements.txt:
pip3 install -r requirements.txt --user --break-system-packages
The CLI flashcard game provides an engaging way to practice coding questions with progress tracking.
python3 flashcard_game.py
- Interactive menus with emoji indicators
- Multiple practice modes: Random, category-based, difficulty-based
- Progressive hints before viewing solutions
- Progress tracking with statistics and streaks
- Session summaries with accuracy and duration
hint
- Get helpful hintssolution
- View complete solutioncorrect
- Mark answer as correctwrong
- Mark answer as wrongskip
- Skip current questionquit
- End practice session
The simple CLI provides basic question browsing.
python3 cli.py --list
python3 cli.py --question 1
python3 cli.py --help
The Flask application provides a comprehensive REST API with a modern web interface.
python3 app.py
The server will start on http://localhost:5000
- GET / - Modern web interface for managing questions
- GET /api - API documentation and information
Question Management:
- GET /questions - List all questions (with optional filtering)
- GET /questions/ - Get specific question by ID
- GET /questions/difficulty/ - Get questions by difficulty
- POST /questions - Add new question
- PUT /questions/ - Update existing question
- DELETE /questions/ - Delete question
Practice Features:
- GET /practice/random - Get random question for practice
- POST /practice/submit - Submit solution for evaluation
Utility:
- GET /health - Health check endpoint
- GET /stats - Get statistics about questions
# Health check
curl http://localhost:5000/health
# Get all questions
curl http://localhost:5000/questions
# Get questions by difficulty
curl http://localhost:5000/questions/difficulty/Easy
# Add new question
curl -X POST http://localhost:5000/questions \
-H "Content-Type: application/json" \
-d '{"title":"New Question","difficulty":"Medium","description":"Description"}'
# Get random question
curl http://localhost:5000/practice/random
# Get statistics
curl http://localhost:5000/stats
Run the main algorithmic functions directly:
python3 main.py
This will execute the Fibonacci sequence demonstration.
Execute the test suite to verify all components work correctly:
# Test algorithmic functions
python -m pytest test_main.py -v
# Test CLI interface
python -m pytest test_cli.py -v
# Test web API
python -m pytest test_app.py -v
# Run all tests
python -m pytest test_*.py -v
# Test help
python cli.py --help
# Test listing questions
python cli.py --list
# Test specific question
python cli.py --question 1
# Start the server
python3 app.py
# In another terminal, test endpoints
curl http://localhost:5000/health
curl http://localhost:5000/api
curl http://localhost:5000/questions
curl http://localhost:5000/stats
# Or open in browser
# http://localhost:5000/ (web interface)
python main.py
The tool includes 6+ LeetCode problems across multiple categories:
- Two Sum (Easy) - Find two numbers that add up to target
- Best Time to Buy and Sell Stock (Easy) - Maximize profit from stock prices
- 3Sum (Medium) - Find all unique triplets that sum to zero
- Valid Palindrome (Easy) - Check if string is palindrome after cleaning
- Reverse Linked List (Easy) - Reverse a singly linked list
- Maximum Depth of Binary Tree (Easy) - Find the maximum depth of a binary tree
- Fibonacci Sequence (Easy) - Calculate nth Fibonacci number
- Reverse String (Easy) - Reverse a string in place
Each question includes:
- Detailed problem statements with examples
- Multiple solution approaches with complexity analysis
- Progressive hints for learning
- Complete code implementations
To add new questions, modify the load_questions()
function in cli.py
:
def load_questions():
return [
# ... existing questions ...
{
"id": 3,
"title": "New Question",
"difficulty": "Medium",
"description": "Question description",
"example": "Input: ...\nOutput: ...",
},
]
To add new endpoints to the web API, modify app.py
:
@app.route("/questions")
def get_questions():
# Implementation here
pass
For development with auto-reload:
# Flask development server
export FLASK_ENV=development
python app.py
- Import Errors: Ensure you're running commands from the project root directory
- Port Already in Use: Change the port in
app.py
or kill the existing process - Missing Dependencies: Install Flask with
pip install flask
Enable debug mode for detailed error messages:
export FLASK_DEBUG=1
python app.py
- Add new questions to the
load_questions()
function - Implement corresponding algorithmic solutions
- Add comprehensive tests
- Update this README with new features
- Fork/Clone this repository to your GitHub account
- Sign up at render.com
- Connect your GitHub account
- Create New Web Service
- Select your repository
- Configure:
- Name:
python-technical-questions
- Environment:
Python
- Build Command:
pip install -r requirements.txt
- Start Command:
gunicorn app:app
- Name:
- Deploy! Your app will be live at
https://your-app-name.onrender.com
- Sign up at railway.app
- Connect GitHub and select this repository
- Railway auto-detects Flask app
- Deploy automatically
- Get your live URL
- Install Heroku CLI
- Login:
heroku login
- Create app:
heroku create your-app-name
- Deploy:
git push heroku master
- Open:
heroku open
For production, consider setting:
FLASK_ENV=production
FLASK_DEBUG=false
This project is open source and available under the MIT License.