#1 Data Analytics Program in India
₹2,499₹1,499Enroll Now
8 min read

Introduction to Python

Get started with Python programming fundamentals

What You'll Learn

  • Why Python for data analysis
  • Basic Python syntax
  • Variables and data types
  • Your first Python program

Why Python?

Python is one of the most popular programming languages in the world. It's especially loved by beginners and data analysts.

Reasons to choose Python:

Easy to Read: Python code looks like English. You can understand what it does just by reading it. Unlike other languages with confusing symbols, Python uses simple words.

Great for Data: Python has special tools (called libraries) that help you work with data, make charts, and analyze information. These tools do the hard work for you.

Popular: Millions of people use Python. This means when you get stuck, you can easily find help online. There are tutorials, videos, and forums everywhere.

Multiple Uses: You can use Python for data analysis, building websites, creating games, or even artificial intelligence. Learn once, use everywhere!

Your First Program

The first thing every programmer learns is printing text on screen. In Python, we use the print command.

code.py
print("Hello, Python!")

What this does: When you run this code, Python shows the message "Hello, Python!" on your screen. The quotation marks tell Python this is text, not a command.

Variables

Think of variables like labeled boxes. You put information in the box and give it a name. Later, you can use that name to get the information back.

Why use variables? Instead of typing the same information over and over, you store it once and reuse it. If the information changes, you only update it in one place.

code.py
name = "Alice"
age = 25

What happens here: We created two boxes. One labeled "name" holds the text "Alice". Another labeled "age" holds the number 25. Now we can use these anytime in our program.

Basic Data Types

Data types are different kinds of information Python can work with. Just like in real life, we handle numbers differently than we handle words.

Main types you will use:

1. Numbers - For counting and calculating

  • Whole numbers: 10, 25, 100
  • Decimal numbers: 19.99, 98.6
code.py
age = 25
price = 19.99

2. Text (Strings) - For words and sentences

  • Always written inside quotes
  • Can be combined together
code.py
name = "Alice"
greeting = "Hello " + name

3. Lists - For storing multiple items

  • Like a shopping list
  • Written inside square brackets
code.py
fruits = ["apple", "banana", "orange"]

Simple Operations

Python can do math just like a calculator. You can add, subtract, multiply, and divide numbers.

Basic math symbols:

  • Plus sign for addition
  • Minus sign for subtraction
  • Star for multiplication
  • Slash for division
code.py
x = 10
y = 3
print(x + y)   # Shows: 13

Working with text:

You can also do operations on text! Python can make text uppercase, lowercase, or count how many letters are in a word.

code.py
text = "python"
print(text.upper())  # Shows: PYTHON

Practice Example

Let's create a simple program that calculates a total price. This is something you might do in real life when shopping.

The scenario: You are buying 2 laptops at 999 dollars each.

code.py
item = "Laptop"
price = 999
quantity = 2

total = price * quantity
print(item, "costs", total)

What happened: Python multiplied the price by quantity and showed us the total. This is much faster than using a calculator!

Key Points to Remember

Simple Language: Python code reads like English sentences. "age = 25" means "age equals 25" - easy to understand!

No Complicated Setup: Unlike other languages, you don't need to declare what type of data you are storing. Just give it a name and a value.

Names Matter: Use clear names like total_price instead of tp. Future you will thank you!

Comments Help: Start a line with hashtag to write notes. Python ignores these, but they help humans understand the code.

Spacing is Important: Python uses indentation (spaces) to organize code. We will learn more about this later.

Next Steps

Now let's learn about setting up your development environment!