Home Page class 12 @ Python

CBSE Class 12 : Data Structures

Introduction to Data Structures

CBSE Class 12 : Searching

Creation And Traversal
What is Searching?
Linear/Sequential Search
Binary Search
Insertion Of Element
Deletion Of Element

CBSE Class 12 : Sorting

What is sorting?
Bubble Sort
Selection Sort
Insertion Sort

CBSE Class 12 : Stacks

Stacks
Applications of Stacks
Implementation of Stacks

CBSE Class 12 : Queues

Queues
Applications Of Queues
Implementation of Queues

Class 12 Data Structures | Queues 8

Maintaining Bank details like accno, name and balance using Queues (Using Functions)

#queue implementation using functions
#program to create a queue of bank(acno,name,bal).
"""
Add custmer
delete customer
display details
"""
bank=[]
def Add_customer():
        acno=input("Enter account no.  ")
        name=input("Enter name ")
        bal=input("Enter balance ")
        b=(acno,name,bal)
        bank.append(b)
def del_customer():
        if(bank==[]):
                print("Underflow / bank queue in empty")
        else:
                acno,name,bal=bank.pop(0)
                print("poped element is ")
                print("Accountno ",acno," name ",name," balance ",bal)
def traverse():
        if not (bank==[]):
                n=len(bank)
                for i in range(0,n):
                        print(bank[i])
        else:
                print("Empty , No details to display")
while True:
        print("1. Add details of bank customer")
        print("2. delete details of bank customer")
        print("3. Display details of bank")
        print("4. Exit")
        ch=int(input("Enter your choice "))
        if(ch==1):
                Add_customer()
        elif(ch==2):
                del_customer()
        elif(ch==3):
                traverse()
        elif(ch==4):
                print("End")
                break
        else:
                print("Invalid choice")