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

  1. Download Python from python.org
  2. Install with “Add Python to PATH” checked
  3. Open Command Prompt/Terminal and type python --version
  4. 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

  1. Write a program to check if a number is even or odd
  2. Calculate the factorial of a number
  3. Print Fibonacci series up to n terms
  4. Check if a string is palindrome
  5. Find the largest of three numbers
  6. Create a simple calculator (+, -, *, /)
Learning Path:
  1. Variables, Data Types, Operators (Week 1)
  2. Conditionals, Loops (Week 2)
  3. Lists, Strings, Functions (Week 3-4)
  4. File Handling, Modules (Week 5-6)
  5. OOP Concepts (Week 7-8)

Continue Your Programming Journey

Explore more resources for engineering and computer science students.

More Programming Tutorials →

Leave a Reply

Your email address will not be published. Required fields are marked *