Introduction to Python
Python is a simple and powerful programming language.
It is easy to read, easy to write, and easy to understand.
Even if you have never written code before, Python is a great place to start.
Its syntax looks almost like plain English, so you can focus on logic instead of remembering complex rules.
Python is used almost everywhere —
for web development, data analysis, machine learning, automation, and more.
That’s why it’s one of the most popular languages in the world.
Learning Python helps you build a strong base for your tech journey.
You can create small scripts, analyze data, or even build AI models — all using Python.
Why learn Python?
- Simple and beginner-friendly
- Works for many different types of projects
- Has thousands of built-in libraries
- Used by companies and developers worldwide
- High demand in jobs and projects
In this series, we’ll start from the basics and move step by step toward advanced topics.
This first notebook is all about understanding the core ideas that every Python program is built on.
Python Basics
This notebook covers the foundation of Python programming.
These are essential concepts you will use in almost every program.
Topics covered:
- Printing output using
print()→ display messages or results - Taking input from the user using
input()→ interact with users - Variables → store data for later use
- Basic arithmetic operations (
+,-,*,/,//,%,**) → perform calculations
Why these basics matter:
- Printing helps debug and display results
- Input allows programs to interact dynamically with users
- Variables store values so they can be reused or modified
- Arithmetic operations are the foundation for calculations and logic
Examples of real-time usage:
- Printing a welcome message or instructions to the user
- Taking user age or name to personalize a program
- Calculating total bill, discount, or tax
- Using variables to store scores, results, or inventory counts
We will cover:
- Printing output (
print()) - Taking input (
input()) - Variables
- Basic arithmetic operations
Printing Output
# ---- Printing Output ----
# The print() function displays text or values on the screen.
# Useful for showing messages, results, or debugging.
print("Hello, World!") # prints a simple greeting
print(100) # prints a number directly
print("Sum of 2 and 6 is:", 2 + 6) # prints text + result of additionHello, World!
100
Sum of 2 and 6 is: 8
Taking Input from User
# ---- Taking Input from User ----
# input() allows the user to type something.
# By default, input() returns a string.
# We can convert it to int or float if needed.
# Ask for user's name
name = input("Enter your name: ") # stores input as string
print("Hello,", name) # greet the user
# Ask for user's age
age = int(input("Enter your age: ")) # convert string to integer
print("You are", age, "years old.") # print age with messageHello, W3Buddy
You are 25 years old.
Variables
# ---- Variables ----
# A variable is a container to store data.
# We can name it and assign values using '='.
x = 5 # x stores an integer
y = 3.14 # y stores a float (decimal number)
name = "Amit" # name stores a string
# Print the stored values
print("x:", x)
print("y:", y)
print("name:", name)
# Variables can be updated with new values
x = 10
print("New value of x:", x)x: 5
y: 3.14
name: Amit
New value of x: 10
Arithmetic Operations
# ---- Arithmetic Operations ----
# These operators perform calculations on numbers.
# + : addition, - : subtraction, * : multiplication
# / : division (returns float), // : floor division (integer)
# % : modulus (remainder), ** : exponentiation (power)
a = 15
b = 4
print("Addition (a + b):", a + b)
print("Subtraction (a - b):", a - b)
print("Multiplication (a * b):", a * b)
print("Division (a / b):", a / b)
print("Floor Division (a // b):", a // b)
print("Modulus (a % b):", a % b)
print("Exponentiation (a ** b):", a ** b)Addition (a + b): 19
Subtraction (a – b): 11
Multiplication (a * b): 60
Division (a / b): 3.75
Floor Division (a // b): 3
Modulus (a % b): 3
Exponentiation (a ** b): 50625
Summary
We learned:
print()to display outputinput()to take user input- How to use variables to store and update data
- Basic arithmetic operations (+, -, *, /, //, %, **)
Next notebook: 02_data_types.ipynb
