Artificial intelligence includes rule-based programs as well as machine learning. Start with Python and a small local rule-based example; an external AI service or API key is not required.
What you need
- Python and a code editor
- A practice folder and virtual environment
- Optional: a browser notebook such as Google Colab
Set up your environment
- Install Python and create an
ai-practicefolder. Runpython -m venv .venv. - Use the virtual-environment interpreter for this project. This first example uses only the Python standard library, so no pip packages are required.
- Save assistant.py with the code below and run it. Type hello when prompted.
- If using a browser notebook instead, create a Python notebook and run the code in a cell. Save your work; cloud sessions are not permanent local installations.
Your first check
Save as assistant.py
message = input('Say something: ').strip().lower()
responses = {'hello': 'Hello, learner!', 'help': 'Choose a lesson to begin.'}
print(responses.get(message, 'Try hello or help.'))Run or verify
Windows: .venv\Scripts\python.exe assistant.py
Linux/macOS: .venv/bin/python assistant.pyExpected result: Typing hello returns Hello, learner! This is a rule-based program; it does not train or understand language.
Common setup problems
- You do not need to buy an API subscription for these local beginner exercises.
- Use sample data in shared notebooks and keep passwords, private records and access tokens out of your code.
Official documentation
Guide reviewed 17 November 2026. Check the linked vendor documentation for current supported versions and operating systems.