generate electricity bill in python program CSE January 03, 2026 def calculate_electricity_bill(units): """ Calculates the electricity bill based on tiered unit charges. Args: ... Continue Reading
BST - BINARY SEARCH TREE - PYTHON CSE December 24, 2025 # Binary Search Tree implementation with user interaction class Node: def __init__(self, key): self.key = key self.left... Continue Reading
Python - Double Linked List CSE December 24, 2025This program includes methods for inserting at the beginning and end, and deleting a specific node by its value. # -----------------------... Continue Reading
Python - Single Linked List CSE December 23, 2025 Python - Single Linked List class Node: """Represents a single node in the linked list.""" def __init... Continue Reading
Write a python program to implement Queues. CSE December 23, 2025 Write a python program to implement Queues. from collections import deque class Queue: def __init__(self): self.queue = deque()... Continue Reading
Write a program to implement Stacks in python. CSE December 23, 2025 Write a program to implement Stacks. class Stack: def __init__(self): self.stack = [] def push(self, item): "... Continue Reading
Selection Sort - Python CSE December 23, 2025 def selection_sort(arr): """ Sorts a list of elements using the selection sort algorithm. """ ... Continue Reading
Merge Sort in Python – Explanation, Algorithm, and Program CSE December 23, 2025Sorting is one of the most important operations in computer science. It is used to arrange data in a specific order, usually ascending or de... Continue Reading
Quick Sort - Python CSE December 23, 2025 def quick_sort_simple(arr): if len(arr) <= 1: return arr # Base case: a list with 0 or 1 element is already sorted else... Continue Reading
Python - Bubble Sort CSE December 23, 2025 def bubble_sort(arr): """ Sorts a list of elements in ascending order using the bubble sort algorithm. Args: ... Continue Reading
Python - Binary Search CSE December 23, 2025 def binary_search(arr, target): low = 0 high = len(arr) - 1 while low <= high: mid = (low + high) // 2 if a... Continue Reading
write a program for linear search in python. CSE December 23, 2025 write a program for linear search in python. def linear_search(arr, target): """ Returns the index of target if foun... Continue Reading
Write a Python program to generate the combinations of n distinct objects taken from the elements of a given list. Example: Original list: [1, 2, 3, 4, 5, 6, 7, 8, 9] Combinations of 2 distinct objects: [1, 2] [1, 3] [1, 4] [1, 5] .... [7, 8] [7, 9] [8, 9] CSE December 23, 2025 Write a Python program to generate the combinations of n distinct objects taken from the elements of a given list. Example: Original list: ... Continue Reading
Write a Python program to illustrate the following comprehensions: a) List Comprehensions b) Dictionary Comprehensions c) Set Comprehensions d) Generator Comprehensions CSE December 23, 2025 Write a Python program to illustrate the following comprehensions: a) List Comprehensions b) Dictionary Comprehensions c) Set Comprehension... Continue Reading
Write a python program to implement Method Overriding. CSE December 23, 2025 Write a python program to implement Method Overriding. class Animal: """A parent class representing an animal."... Continue Reading
Write a python program to implement Method Overloading. CSE December 23, 2025 Write a python program to implement Method Overloading. 1. Using Default Arguments class Calculator: # Simulates overloading the 'a... Continue Reading
Python - Develop an inheritance hierarchy based upon a Polygon class that has abstract methods area( ) and perimeter( ). Implement classes Triangle, Quadrilateral, Pentagon, that extend this base class, with the obvious meanings for the area( ) and perimeter( ) methods. Write a simple program that allows users to create polygons of the various types and input their geometric dimensions, and the program then outputs their area and perimeter. CSE December 23, 2025 Develop an inheritance hierarchy based upon a Polygon class that has abstract methods area( ) and perimeter( ). Implement classes Triangle,... Continue Reading
Write a Python program for class, Flower, that has three instance variables of type str, int, and float that respectively represent the name of the flower, its number of petals, and its price. Your class must include a constructor method that initializes each variable to an appropriate value, and your class should include methods for setting the value of each type, and retrieving the value of each type. CSE December 23, 2025 Write a Python program for class, Flower, that has three instance variables of type str, int, and float that respectively represent the nam... Continue Reading
Write a python program to sum all the items in a given dictionary. CSE April 25, 2025 # Sample dictionary with numeric values my_dict = { "a": 10, "b": 20, "c": 30 } # Sum of all valu... Continue Reading
Write a python program to add a new key-value pair to an existing dictionary. CSE April 25, 2025# Existing dictionary my_dict = { "name": "Anjali", "age": 23, "city": "Delhi"... Continue Reading