PYTHON Get Started

Step 1: Install Python

Windows

  1. Download Python from python.org
  2. Run the installer and select Add Python to PATH
  3. Verify installation by opening the command prompt and typing:
    python --version
    

    Try It Now

Mac & Linux

Python is pre-installed on most systems. To check:

python3 --version

Try It Now

If not installed, use:

sudo apt install python3  # Ubuntu/Debian  
brew install python       # macOS  

Try It Now

Step 2: Run Your First Python Program

Using the Python Shell

Open a terminal or command prompt and type:

python

Try It Now

Then, enter:

print("Hello, World!")

Try It Now

Using a Python Script

  1. Create a new file hello.py
  2. Add this code:
    print("Hello, Python!")
    

    Try It Now

  3. Run the script:
    python hello.py
    

    Try It Now

Step 3: Python Basics

Before diving deep, learn the basics:

1. Variables & Data Types

name = "Alice"  # String
age = 25        # Integer
height = 5.6    # Float
is_student = True  # Boolean

Try It Now

2. Conditional Statements

age = 18
if age >= 18:
    print("You are an adult.")
else:
    print("You are a minor.")

Try It Now

3. Loops in Python

for i in range(5):
    print("Iteration:", i)

Try It Now

4. Functions in Python

def greet(name):
    return "Hello, " + name

print(greet("Alice"))

Try It Now

Step 4: Install a Code Editor (Optional)

For better coding experience, use:
VS CodeDownload
PyCharmDownload