Python for Beginners – Complete Tutorial for Students 2026

Python is the most beginner-friendly programming language and essential for engineering students, data science, and competitive programming. This complete guide takes you from zero to writing your first programs.
Why Learn Python?
- Easy to Learn: Simple, readable syntax similar to English
- High Demand: Used in AI, Data Science, Web Development, Automation
- Career Opportunities: Python developers earn ₹6-15 LPA starting salary
- Academic Use: Required for CBSE Class 11-12, Engineering courses
- Versatile: One language for multiple domains
Setting Up Python
- Download Python from python.org
- Install with “Add Python to PATH” checked
- Open Command Prompt/Terminal and type
python --version - Use IDLE (comes with Python) or VS Code for writing code
Your First Python Program
# This is a comment
print("Hello, World!")
print("Welcome to Python Programming")
Output:
Hello, World!
Welcome to Python Programming
Variables and Data Types
# Variables - storing data
name = "Rahul" # String (text)
age = 17 # Integer (whole number)
height = 5.8 # Float (decimal)
is_student = True # Boolean (True/False)
# Printing variables
print("Name:", name)
print("Age:", age)
print("Height:", height)
Basic Operations
# Arithmetic Operations
a = 10
b = 3
print(a + b) # Addition: 13
print(a - b) # Subtraction: 7
print(a * b) # Multiplication: 30
print(a / b) # Division: 3.333...
print(a // b) # Floor Division: 3
print(a % b) # Modulus (remainder): 1
print(a ** b) # Power: 1000
Taking User Input
# Getting input from user
name = input("Enter your name: ")
age = int(input("Enter your age: "))
print("Hello", name)
print("You will be", age + 1, "next year")
Conditional Statements (if-else)
# Check if student passed
marks = int(input("Enter marks: "))
if marks >= 90:
print("Grade: A+")
elif marks >= 80:
print("Grade: A")
elif marks >= 70:
print("Grade: B")
elif marks >= 60:
print("Grade: C")
elif marks >= 33:
print("Grade: D - Pass")
else:
print("Grade: F - Fail")
Loops – Repeating Code
# For loop - repeat known times
for i in range(1, 6):
print("Count:", i)
# While loop - repeat until condition
count = 1
while count <= 5:
print("Count:", count)
count = count + 1
# Print multiplication table
num = 7
for i in range(1, 11):
print(num, "x", i, "=", num * i)
Lists - Storing Multiple Values
# Creating a list
fruits = ["Apple", "Banana", "Orange", "Mango"]
print(fruits[0]) # First item: Apple
print(fruits[-1]) # Last item: Mango
print(len(fruits)) # Length: 4
# Adding and removing
fruits.append("Grapes") # Add at end
fruits.remove("Banana") # Remove item
# Loop through list
for fruit in fruits:
print(fruit)
Functions - Reusable Code
# Defining a function
def greet(name):
print("Hello,", name, "!")
print("Welcome to Python")
# Calling the function
greet("Priya")
greet("Amit")
# Function with return value
def add_numbers(a, b):
return a + b
result = add_numbers(5, 3)
print("Sum:", result)
Practice Problems for Beginners
- Write a program to check if a number is even or odd
- Calculate the factorial of a number
- Print Fibonacci series up to n terms
- Check if a string is palindrome
- Find the largest of three numbers
- Create a simple calculator (+, -, *, /)
Learning Path:
- Variables, Data Types, Operators (Week 1)
- Conditionals, Loops (Week 2)
- Lists, Strings, Functions (Week 3-4)
- File Handling, Modules (Week 5-6)
- OOP Concepts (Week 7-8)
Continue Your Programming Journey
Explore more resources for engineering and computer science students.
More Programming Tutorials →
Leave a Reply