FREE E LEARNING PLATFORM
☰ HOMEEXCEPTIONSOOPSJVMINTRO
×

Python Syllabus

AKTU Python Syllabus AKTU Python Freshers AKTU Python Advanced AKTU Pyton PYQ AKTU Pyton PYQS 2026 AKTU Pyton PYQS 2025 AKTU Pyton PYQS 2024

Unit I Introduction

Introduction to Python History of Python Features of Python Applications of Python Python Installation Python IDE Python Program Life Cycle First Python Program Blocks & Indentation Comments Keywords Identifiers Variables Input & Output Data Types Numeric Data Types Type Conversion Python Operators

Unit II Control Statements

if Statement if...else Statement Nested if elif Statement for Loop range() Function while Loop Nested Loops break Statement continue Statement pass Statement else with Loop

Unit III Complex Data Types

Strings String Operations String Methods String Built-in Functions Lists List Slicing List Methods List Built-in Functions Tuples Tuple Methods Dictionaries Dictionary Methods Dictionary Built-in Functions Python Built-in Functions Python Functions User Defined Functions Lambda Functions Recursive Functions

Unit IV File Handling

Introduction to File Handling open() read() readline() readlines() write() writelines() File Pointer seek() tell() File Modes

Unit V Packages & GUI

Modules Packages NumPy Pandas Matplotlib Tkinter Introduction Tkinter Widgets Button Widget Label Widget Entry Widget Frame Widget Menu Widget Event Handling Programming with IDE Tkinter Mini Project

Python Programs

100+ Solved Programs Pattern Programs File Programs Tkinter Programs

AKTU Questions

Unit I Questions Unit II Questions Unit III Questions Unit IV Questions Unit V Questions Viva Questions Python MCQs

Previous Papers

AKTU 2026 (Solved) AKTU 2025 (Solved) AKTU 2024 (Solved) AKTU 2023 (Solved) AKTU 2022 (Solved)
 

Python if-else Statement

The if-else statement in Python is used to make a decision based on a condition. If the condition is True, the statements inside the if block are executed. If the condition is False, the statements inside the else block are executed.

Syntax of if-else Statement

if condition:
    statement(s)
else:
    statement(s)

The if and else blocks are identified using indentation. The colon : is required after the condition.

Simple if-else Example

age = 20

if age >= 18:
    print("You are eligible to vote.")
else:
    print("You are not eligible to vote.")

Output:

You are eligible to vote.

Checking Even and Odd Numbers

The if-else statement can be used to determine whether a number is even or odd.

num = 15

if num % 2 == 0:
    print("Even number")
else:
    print("Odd number")

Output:

Odd number

Taking Input from the User

marks = int(input("Enter your marks: "))

if marks >= 40:
    print("Pass")
else:
    print("Fail")

Here, the condition marks >= 40 determines whether the student has passed or failed.

if-else with Comparison Operators

Comparison operators such as ==, !=, >, <, >= and <= can be used in conditions.

a = 25
b = 30

if a > b:
    print("a is greater")
else:
    print("b is greater or equal")

if-else with Strings

password = input("Enter password: ")

if password == "python123":
    print("Access granted")
else:
    print("Access denied")

if-else with Logical Operators

Logical operators such as and, or and not can be used to combine conditions.

age = 25

if age >= 18 and age <= 60:
    print("Eligible")
else:
    print("Not eligible")

if-else with Membership Operator

fruits = ["apple", "banana", "mango"]

if "mango" in fruits:
    print("Mango is available")
else:
    print("Mango is not available")

Finding the Greater of Two Numbers

a = 45
b = 30

if a > b:
    print("Greater number:", a)
else:
    print("Greater number:", b)

Checking Positive or Negative Number

num = -10

if num >= 0:
    print("Positive number")
else:
    print("Negative number")

if-else with Boolean Values

is_logged_in = True

if is_logged_in:
    print("Welcome")
else:
    print("Please login")

if-else and Indentation

Python uses indentation to define the body of if and else. Incorrect indentation results in an error.

num = 10

if num > 5:
    print("Number is greater than 5")
else:
    print("Number is 5 or less")

Multiple Statements inside if-else

marks = 75

if marks >= 40:
    print("Result: Pass")
    print("Congratulations!")
else:
    print("Result: Fail")
    print("Better luck next time.")

if-else with a List

numbers = [10, 20, 30]

if len(numbers) > 0:
    print("List is not empty")
else:
    print("List is empty")

Difference between if and if-else

if if-else
Executes a block only when the condition is True. Executes one block when True and another block when False.
Does not require an else block. Contains both if and else blocks.
Used when no action is required for False. Used when an alternative action is required.

Important Points

  • if checks a condition.
  • else executes when the if condition is False.
  • A colon : is required after if and else.
  • Python uses indentation to define blocks.
  • The condition must produce a Boolean result.
  • Comparison, logical and membership operators can be used in conditions.
  • Only one of the if or else blocks executes in a simple if-else statement.