- Install Python and verify it works
- Understand the REPL (interactive shell)
- Write and run your first Python script
- Know the difference between running JS and Python
| Task | JavaScript (Node) | Python |
|---|---|---|
| Check version | node --version |
python3 --version |
| Run a file | node app.js |
python3 hello.py |
| Print output | console.log("Hi") |
print("Hi") |
| Interactive shell | node |
python3 |
| Exit shell | .exit or Ctrl+C |
exit() or Ctrl+D |
| Package manager | npm |
pip |
| File extension | .js |
.py |
Download from https://python.org β always install Python 3.10 or newer.
# Verify installation
python3 --version
# Python 3.12.0
pip3 --version
# pip 23.xWindows users: Check "Add Python to PATH" during installation.
// hello.js
console.log("Hello, World!");
console.log("My name is Ahmed");node hello.js
# Hello, World!
# My name is Ahmed# hello.py
print("Hello, World!")
print("My name is Ahmed")python3 hello.py
# Hello, World!
# My name is AhmedKey difference: print() replaces console.log(). No semicolons. No curly braces.
The REPL lets you type Python and see results immediately β perfect for experimenting.
$ node
> 2 + 2
4
> "hello".toUpperCase()
'HELLO'
> .exit$ python3
>>> 2 + 2
4
>>> "hello".upper()
'HELLO'
>>> exit()The >>> is Python's prompt. Each line runs immediately.
# Create a file
touch hello.py
# Run it
python3 hello.py
# Run with output
python3 -c "print('Hello from command line')"VS Code
βββ Python extension (ms-python.python)
βββ IntelliSense (autocomplete)
βββ Linting (catches errors)
βββ Debugger (breakpoints)
# Try this in your REPL or a file
print("Hello, World!")
print(2 + 2)
print(10 * 5)
print("Ahmed" + " " + "Bro")
print(type(42))
print(type("hello"))Expected output:
Hello, World!
4
50
Ahmed Bro
<class 'int'>
<class 'str'>
| Mistake | Wrong | Right |
|---|---|---|
| Using JS syntax | console.log("hi") |
print("hi") |
| Adding semicolons | print("hi"); |
print("hi") |
| Wrong command | python hello.py |
python3 hello.py |
| Python 2 | python --version β 2.7 |
Must be 3.x |