π Open Python
Python can be used in several ways depending on your environment. Below are the most common options.
π₯οΈ Option 1 β Local Computer (Terminal / Command Line)
πͺ Windows
Open Command Prompt
(Press Windows key β type cmd β Enter)
π Mac
Open Terminal
(Applications β Utilities β Terminal)
π§ Linux
Open Terminal
(You already know the drill π)
βΆοΈ Start Python Interactive Mode (REPL)
The interactive mode lets you execute Python commands one by one.
python3
You should see something like:
>>>
That means Python is running and ready.
π Run a Python Script File
If you have a file such as my_file.py:
python3 my_file.py
Python will execute the entire script.
β Exit Python Interactive Mode
exit()
You can also press:
Ctrl + D (Mac / Linux)
Ctrl + Z + Enter (Windows)
βοΈ Option 2 β Google Colab (No Installation β‘)
If you want to start coding immediately without installing anything, you can use Google Colab.
Colab runs Python in the cloud inside your browser.
β Advantages
- π Zero installation
- π» Works on any device
- π¦ Libraries pre-installed (NumPy, Pandas, Matplotlibβ¦)
- π€ GPU support available
- π Notebook style (great for experiments and learning)
βΆοΈ How to Start
- Go to: https://colab.research.google.com
- Click New Notebook
- Start writing Python code:
print("Hello, world!")
Press Shift + Enter to run the cell.
π§ When to Use Each Option
| Situation | Best Choice |
|---|---|
| Learning basics quickly | βοΈ Colab |
| Data science / experiments | βοΈ Colab |
| Offline development | π₯οΈ Local Python |
| Real projects / scripts | π₯οΈ Local Python |
π§© Mental Model
Python = Engine π§
Terminal β Direct control
Script file β Automated execution
Colab β Cloud laboratory βοΈ
β¨ Recommendation for Beginners
Start with Colab for speed and simplicity, then move to local Python once you feel comfortable.