smartyfy.mrindigi.com

001. Introduction to Python and Programming

Python Mastery
Module 1 · Foundations
Lesson 1 of 200
~45 min
LESSON 001

Introduction to Python & Programming

Start with the big picture: what programming is, why Python matters, how Python code becomes instructions a computer can execute, and where professional developers use Python today.

Course progress · Lesson 1 / 200

Python programming code on a laptop
▶

Lesson Video

Video URL will be added here later

What you’ll learn

✓ What programming means
✓ Why Python is widely used
✓ How Python code executes
✓ How to run your first commands

CONCEPT 1

What is programming?

Programming is the process of describing a solution to a problem as a precise sequence of instructions that a computer can execute. A program receives input, performs operations, makes decisions, stores or transforms information, and produces output.

1. Input
Receive data
2. Process
Work with data
3. Decide
Apply logic
4. Output
Show result

This input → process → output pattern appears everywhere—from a calculator to a banking application, recommendation system, game, website, or AI assistant.

CONCEPT 2

Why Python?

Python emphasizes readable syntax and has a broad ecosystem. It is used for automation, back-end systems, APIs, testing, data science, machine learning and AI. Its syntax lets beginners focus on problem solving while still supporting professional software engineering.

Automation

Files, reports, repetitive office tasks and workflows.

Web & APIs

Backend services, web applications and integrations.

AI & Data

Data analysis, ML, deep learning and LLM applications.

LIVE CODE EXAMPLE

Your first Python program

Python


Output

Click “Run Code” to see the result here.


Step-by-step explanation

1. print()

A built-in Python function used to display information. Text values are placed inside quotation marks.

2. Variables

name and goal are labels that refer to values. You will study variables deeply in Lesson 5.

3. Execution order

Python normally executes statements from top to bottom. Each line can use values created by earlier lines.

DEEP DIVE

Values and data types

Python works with different kinds of values. The four essential beginner types are str for text, int for whole numbers, float for decimal numbers, and bool for True/False values.

Example Type Meaning
"Madhu" str Text
25 int Whole number
25.5 float Decimal number
True bool Boolean value
print(type("Madhu"))
print(type(25))
print(type(25.5))
print(type(True))
DEEP DIVE

Variables and assignment

A variable is a meaningful name that refers to a value. In Python, the = symbol is the assignment operator: it assigns the value on the right to the name on the left.

name = "Madhu"
age = 33

score = 10
score = score + 5
print(score)
Output: 15

Good naming

user_age, total_amount, and song_count communicate intent. A name cannot begin with a digit, so 2name is invalid.

DEEP DIVE

Basic mathematics

Python supports arithmetic directly. The main operators are +, -, *, /, //, %, and **.

a = 20
b = 10

print(a + b)
print(a - b)
print(a * b)
print(a / b)

print(10 // 3)
print(10 % 3)
print(2 ** 3)
//
Floor division
%
Remainder
**
Power

DEEP DIVE

Strings, input and type conversion

Text values are strings. Modern Python commonly uses f-strings to combine text and values cleanly.

name = "Madhu"
age = 33
print(f"My name is {name} and I am {age} years old.")

input() always returns text. Convert it when you need numeric calculations:

age = int(input("Enter age: "))
next_age = age + 1
print(next_age)
Remember: common conversion functions are int(), float(), str(), and bool().
MINI PROJECT

Build a personal profile program

Combine input, variables, type conversion, calculation and formatted output into one small program.

name = input("Enter your name: ")
age = int(input("Enter your age: "))
city = input("Enter your city: ")

next_year_age = age + 1

print()
print("----- PROFILE -----")
print(f"Name: {name}")
print(f"Age: {age}")
print(f"City: {city}")
print(f"Next year you will be {next_year_age}")

This one program already uses strings, integers, variables, input, conversion, calculation, output and f-strings.

DEBUGGING

Understanding errors

Errors are a normal part of programming. Python usually tells you what failed and where. For example, using a variable that has never been defined can raise a NameError. Learning to read error messages is an essential programming skill.

Hands-on practice

Create a program that stores your name, city and learning goal in variables and prints a short introduction.

Your task

  1. Create three variables: name, city, and goal.
  2. Print each value clearly.
  3. Add one final line that combines the values into a sentence.

Knowledge check

1. What does print() do?

Think about what happened in the first program.

2. Which file extension is normally used for Python source files?
3. Name three real-world areas where Python is commonly used.
Mastery target: answer all 3 without reviewing the lesson.
← Previous lesson

NEXT
002. Installing Python & Setting Up the Environment →