INDEX
#Program 1
WAP to perform create, modify, delete, search, and display functions in a text file.
SOURCE CODE:
myfile=open("[Link]","r+")
str1=[Link]()
str4=””
ans=”y”
print(“\t\tMENU”)
print("1. DISPLAYING FILE")
print(“2. MODIFYING A FILE”)
print(“3. SEARCHING IN A FILE”)
print(“4. DELETING A WORD”)
print(“5. APPENDING SOME DATA”)
while ans==”y”:
n=int(input(“Enter which operation is to be performed: ”))
if n==1:
print(“\t\tDISPLAYING FILE”)
print(str1)
elif n==2:
print(“\t\tMODIFYING A FILE”)
word=input(“Enter word to be modified: ”)
wordn=input(“Enter new word in replace of that: ”)
str2=[Link](word,wordn)
[Link]()
myfile=open(“[Link]”,”w”)
[Link](str2)
[Link]()
myfile=open(“[Link]”,”r”)
str3=[Link]()
print(str3)
[Link]()
elif n==3:
print(“\t\tSEARCHING IN A FILE”)
words=input(“Enter word to search: ”)
for i in [Link]():
if i==words:
print(“Word Found!!!”)
break
else:
print(“Word Not Found!!!”)
elif n==4:
print(“\t\tDELETING A WORD”)
wordd=input(“Enter word to be deleted: ”)
for i in [Link]():
if i==wordd:
continue
else:
str4+=i+””
myfile=open(“[Link]”,”w”)
[Link](str4)
[Link]()
myfile=open(“[Link]”,”r”)
print([Link]())
[Link]()
else:
print(“\t\tAPPENDING SOME DATA”)
data=input(“Enter some data: ”)
myfile=open(“[Link]”,”a”)
[Link](data)
[Link]()
myfile=open(“[Link]”,”r”)
print([Link]())
[Link]()
ans=input(“Do you want to enter more(y/n): ”)
if ans==”n”:
print(“THANKS”)
Output:
#Program 2
WAP in python to create a text file, and then read this file to display the number
of vowels, consonants, uppercase and lowercase characters in the file
SOURCE CODE:
def createfile():
fout=open('[Link]','w')
[Link]("Don't let the opinions of people interfere with the
directions given to you by God.")
[Link](" Does this mean things are going to be perfect? No, but
this does mean that you")
[Link](" have someone in your life who gives you worth,
acceptance, and love.")
[Link]()
createfile()
fin=open("[Link]",'r')
c=0
u=0
v=0
l=0
s=[Link]()
for i in s:
if i in 'aAeEiIoOuU':
v=v+1
elif i not in 'aAeEiIoOuU':
c=c+1
if [Link]():
u=u+1
if [Link]():
l=l+1
print(s)
print('the number of uppercase letters are: ',u)
print('the number of lowercase letters are: ',l)
print('the number of vowels are: ',v)
print('the number of consonants are: ',c)
[Link]()
Output:
#Program 3
WAP in python to create a text file, and then read this file to print all the lines
that contain the character 'a' in this file and also write these lines to another text
file
SOURCE CODE:
def createfile():
fout=open('[Link]','w')
[Link]('apple a day keeps the doctor away')
[Link]("Nature's first green is gold\n")
[Link]("earth is the 3rd planet in the solar system\n")
[Link]("water coverers 70% of earths surface\n")
[Link]()
createfile()
fin=open('[Link]','r')
fout2=open('[Link]','w')
print("No. of lines that contain 'a' are: ")
s=' '
while s:
s=[Link]()
w=[Link]()
for i in w:
if 'a' in i:
print(s)
[Link](s)
break
[Link]()
[Link]()
Output:
#Program 4
WAP in python to read the above created text file and count the occurrence of the
words 'the' or 'THE' in the text file
SOURCE CODE:
def count():
f=open("[Link]",'r')
count=0
s=[Link]()
print(s)
x=[Link]()
for i in x:
if i=='the' or i=='THE':
count=count+1
print("no. of occurrences of 'the' or 'THE' in the above file are:
",count)
[Link]()
count()
Output:
#Program 5
WAP in python to read the above created text file and then write function to
count only the alphabets in this text file and another function to count only the
digits in this text file
SOURCE CODE:
def countalpha():
f1=open('[Link]','r')
c1=0
s=[Link]()
print(s)
x=[Link]()
for i in x:
if [Link]():
c1=c1+1
print(c1)
def countnum():
f2=open('[Link]','r')
c2=0
s1=[Link]()
x=[Link]()
print(s1)
for i in x:
if [Link]():
c2=c2+1
print(c2)
countalpha()
countnum()
Output:
#Program 6
WAP to perform create, modify, delete, search, and display functions in a binary
file
SOURCE CODE:
import os
import pickle
#Accepting data for Dictionary
def insertRec():
rollno=int(input('Enter roll number: '))
name=input('Enter Name: ')
marks=int(input('Enter Marks: '))
rec={'Rollno':rollno,'Name':name,'Marks':marks}
f=open('[Link]','ab')
[Link](rec,f)
[Link]()
#Reading the records
def readRec():
f=open('[Link]','rb')
rows=[]
print('*'*60)
while True:
try:
rec=[Link](f)
#print('Roll No :',rec['Rollno'],end=' ')
#print('Name :',rec['Name'],end=' ')
#print('Marks :',rec['Marks'])
[Link](rec)
print()
except EOFError:
break
for i in rows:
print(i)
print('*'*60)
[Link]()
#Searching a record based on Rollno
def searchRollNo(r):
f=open('[Link]','rb')
flag=False
while True:
try:
rec=[Link](f)
if rec['Rollno']==r:
print('Roll Num :',rec['Rollno'])
print('Name :',rec['Name'])
print('Marks :',rec['Marks'])
flag=True
except EOFError:
break
if flag==False:
print('No Records found')
[Link]()
#Marks Modification for a RollNo
def updateMarks(r,m):
f=open('[Link]','rb')
reclst=[]
while True:
try:
rec=[Link](f)
[Link](rec)
except EOFError:
break
[Link]()
for i in range (len(reclst)):
if reclst[i]['Rollno']==r:
reclst[i]['Marks']=m
f=open('[Link]','wb')
for x in reclst:
[Link](x,f)
[Link]()
#Deleting a record based on Rollno
def deleteRec(r):
f=open('[Link]','rb')
reclst=[]
while True:
try:
rec=[Link](f)
[Link](rec)
except EOFError:
break
[Link]()
f=open('[Link]','wb')
for x in reclst:
if x['Rollno']==r:
continue
[Link](x,f)
[Link]()
while True:
print('*'*60)
print('Type 1 to insert rec.')
print('Type 2 to display rec.')
print('Type 3 to Search RollNo.')
print('Type 4 to update marks.')
print('Type 5 to delete a Record.')
print('Enter your choice 0 to exit')
print('*'*60)
choice = int(input('Enter you choice: '))
print('*'*60)
if choice==0:
break
if choice == 1:
insertRec()
if choice == 2:
readRec()
if choice == 3:
r=int(input('Enter a rollno to search: '))
searchRollNo(r)
if choice == 4:
r=int(input('Enter a rollno: '))
m=int(input('Enter new Marks: '))
updateMarks(r,m)
if choice == 5:
r=int(input('Enter a rollno: '))
deleteRec(r)
Output:
#Program 7
WAP in python to create and read a binary file "[Link]" containing the records
of the following type{'Roll no':<roll no>,'name':<name>.} of a student. The user
should enter the roll number and the function should display the name, if not
found display appropriate message
SOURCE CODE:
import pickle
def create():
fin=open("[Link]","wb")
d={}
n=int(input("enter the no. of entries in the file"))
for i in range(n):
Rollno=int(input("enter the roll no. of the student: "))
Name=input("enter the name of the student: ")
d[Rollno]=Name
[Link](d,fin)
[Link]()
Output:
#Program 8
WAP in python using functions to create and read a binary file "[Link]"
containing the records of following type[Modelno, RAM, HDD, Details]. Also,
write a search function in which the user should enter the model number to
display the details of the laptop where Modelno, RAM, HDD are integers and
Details is a string
SOURCE CODE:
import pickle
def create():
fin=open("[Link]","wb")
n=int(input('enter the no . of entries'))
l=[]
for b in range(n):
modelno=int(input('enter the model no.'))
Ram=int(input('enter the Ram'))
HDD=int(input('enter the HDD'))
Details=input('enter the details')
data=[modelno,Ram,HDD,Details]
[Link](data)
[Link](l,fin)
[Link]()
create()
def read():
fout=open("[Link]","rb")
found=0
try:
while True:
rec=[Link](fout)
print(rec)
y=int(input('enter the model no. to be searched'))
for t in rec:
if t[0]==y:
print('record found')
print('the details of the laptop with
modelno',t[0],'are',t[3])
found=1
break
except:
if found==0:
print('no such record exist')
[Link]()
read()
print('************************************************************\n')
def read():
fout=open("[Link]","rb")
rec=[Link](fout)
print(rec)
y=int(input("enter the model no, to be updated"))
ch='y'
while ch=='y' or ch=="Y":
for i in rec:
i[0]==y
print("model no. is present")
a=int(input("enter the updated ram"))
i[1]=a
print("the change has been done")
ch=input("do you want to continue...y/n")
[Link]()
read()
Output:
#Program 9
WAP in Python to read the above created binary file "[Link]". The function
should input a ModelNo and update the RAM details in this file.
SOURCE CODE:
def read():
fout=open("[Link]","rb+")
rec=[Link](fout)
print("records of file before updating")
print("ModelNo\t","RAM\t","HDD\t","Details\t")
for i in rec:
print(i[0],'\t',i[1],'\t',i[2],'\t',i[3])
found=0
M=int(input("enter the Model no whose ram has to be updated"))
for i in rec:
if i[0]==M:
print("current RAM",i[1])
i[1]=input("enter updated ram")
found=1
break
if found==1:
[Link](0)
[Link](rec,fout)
print("ram updated")
else:
print("no such record found")
[Link]()
read()
Output:
#Program 10
WAP to perform create, modify, delete, search, and display functions in a binary
file
SOURCE CODE:
import csv
def create():
f=open('[Link]','a',newline='')
wrtr=[Link](f)
[Link](["S. No.","Name","Adm No","Marks"])
n=int(input("\n Enter no. of students to write: "))
print()
for i in range(n):
name=input ("Enter name: ")
Adm=int(input("Enter admission no.: "))
marks = int(input("Enter marks: "))
r=[i+1,name,Adm,marks]
[Link](r)
print ('\n')
[Link]()
#==============================
def printing():
f=open('[Link]','r')
rdr=[Link](f)
for i in rdr:
for j in i:
print(j,end=' ')
print()
#====================================
def searchper():
print("Records of those students who have scored more than 90
are:")
f=open('[Link]','r')
rdr=[Link](f)
rows=[]
for i in rdr:
[Link](i)
found = 0
for i in range(1,len(rows)):
print(rows[i])
if ((float(rows[i][3]))/5)>=90.0:
found+=1
rows[i][3]=float(rows[i][3])+2
print(rows[i])
print('='*30)
if found==0:
print("no such record is found")
[Link]()
#==================================
def modify():
print("Modify the (add 2 marks Records of those students who have
scored more than 90 are:")
with open("[Link]","r") as f:
ro=[Link](f)
rows=[]
for rec in ro:
[Link](rec)
print(rec)
print()
print()
for i in range(1,len(rows)):
if int(i[0][3])>=90:
print(i)
rows[i][2]=float(rows[i][2])+2
print(rows)
with open("[Link]","w") as f:
wo=[Link](f,lineterminator='\n')
[Link](rows)
#==================================================
def delete():
print("DELETE THE Records of STUDENT AS PER ADM NO:")
with open("[Link]","r") as f:
ro=[Link](f)
rows=[]
rows1=[]
for rec in ro:
[Link](rec)
print(rec)
n=int(input('enter adm no to be deleted'))
print()
print()
for i in rows:
if str(n) not in i:
[Link](i)
print(i)
print('new list')
print(rows1)
with open("[Link]","w") as f:
wo=[Link](f,lineterminator='\n')
[Link](rows1)
#====================================================
def searchadm():
print("search by adm no:")
f=open('[Link]','r')#file open read mode
rdr=[Link](f)#csv reader created
rows=[]
for i in rdr:
[Link](i)
found=0
ad=int(input('enter the adm no to be searched ?'))
print('='*50)
for i in rows:
if str(ad) in i:
found+=1
print(i)
print('='*50)
if found==0:
print(ad, "adm no not found")
else:
print(ad, "adm found",found,' times')
#to create a menu for csv data files
ans='y'
while ans=='y':
print('*'*50)
print(' main menu of program')
print('='*50)
print('1-create a csv file and input data')
print('2-display')
print('3-chelist')
print('4-modify')
print('5-delete')
print('='*50)
x=int(input('choose ur option ?'))
if x==1:
create()
elif x==2:
printing()
elif x==3:
chking()
elif x==4:
modify()
elif x==5:
delete()
else:
print('wrong choice ')
print()
print('='*50)
ans=input('do u want to run again y/n ?')
print('='*50)
Output:
#Program 11
WAP in python to create a CSV file [Link] with details of the tour [TOURID,
DESTINATION, DAYS, FARE], Search and display all records where the FARE is
between 7500 and 10500, if not such record exists then, display an appropriate
message
SOURCE CODE:
import csv
def create():
with open("[Link]", 'w', newline='') as f:
tour_writer = [Link](f)
tour_writer.writerow(["TOURID", "DESTINATION", "DAYS", "FARE"])
rec = []
ch = 'y'
while [Link]()=='y':
tourid = input("Enter the ID of the tour: ")
destination = input("Enter the destination of the tour: ")
days = input("Enter the number of days of the tour: ")
fare = input("Enter the fare of the tour: ")
[Link]([tourid, destination, days, fare])
ch = input("Do you want to continue...? (Y/N): ")
for i in rec:
tour_writer.writerow(i)
print("Tour records have been created.")
def search():
found = 0
with open("[Link]", 'r') as f1:
reader = [Link](f1)
next(reader) # Skip the header
print("Tours with fare between 7500 and 10500:")
for row in reader:
fare = float(row[3])
if 7500 <= fare <= 10500:
print(row)
found = 1
if found==0:
print("No tours with fare between 7500 and 10500 found.")
create()
search()
#Program 12
WAP in python to create a CSV file [Link] with details of the
employee[EMPID,EMPNAME,SALARY], Search for a give EMPID and display the
name and salary if not found display appropriate message
SOURCE CODE:
import csv
def create2():
f=open(“[Link]”,’w’,newline=’’)
emp=[Link](f)
[Link]([“EMPID”,”EMPNAME”,”SALARY”])
rec=[]
ch=’y’
while ch==’y’ or ch==’Y’:
empid=input(“enter the id of the employee”)
empname=input(“enter the name of the employee”)
salary=input(“enter the salary of the employee”)
Mylist=[empid,empname,salary]
[Link](Mylist)
ch=input(“do you want to continue...? (Y/N)”)
for I in rec:
[Link](i)
[Link]()
create2()
#READING AND SEARCHING A GIVE EMPID
def read():
f1=open(“[Link]”,”r”)
reader=[Link](f1)
next(reader)
search=input(“enter the empid to be searched”)
found=0
print(“records of the existing file:”)
while found==0:
for row in reader:
print(row)
if row[0] ==search :
print(“the employee with the
empid”,row[0],”has the name”,row[1],”has the salary”,row[2])
found = 1
break
if found==0:
print(“Employee with the given EMPID not found.”)
[Link]()
read()
Output to Program 11:
Output to Program 12:
#Program 13
Write a menu driven program in Python to create a list containing n integers with
separate user defined functions to perform the following operations based on this
list. averse the content of the list and push the even numbers onto the stack. Also,
pop and display the content of the stack.
SOURCE CODE:
def reverse_list(lst):
return lst[::-1]
def push_even_numbers(lst, stack):
for number in lst:
if number % 2 == 0:
[Link](number)
print(f"Number {number} pushed to stack.")
def pop_and_display_stack(stack):
print("Popping and displaying stack contents:")
while stack:
number = [Link]()
print(number)
def main():
stack = []
n = int(input("Enter the number of integers: "))
numbers = []
print("Enter the integers:")
for _ in range(n):
num = int(input())
[Link](num)
while True:
print("\nMenu:")
print("1. Reverse the list and push even numbers onto the
stack")
print("2. Pop and display the contents of the stack")
print("3. Exit")
choice = input("Enter your choice (1/2/3): ")
if choice == '1':
reversed_list = reverse_list(numbers)
print("Reversed list:", reversed_list)
push_even_numbers(reversed_list, stack)
elif choice == '2':
pop_and_display_stack(stack)
elif choice == '3':
print("Exiting the program.")
break
else:
print("Invalid choice. Please try again.")
if __name__ == "__main__":
main()
Output:
#Program 14
Write a menu driven program in Python to create a list containing 10 names with
separate user defined functions to perform the following operations based on this
list. Traverse the content of the list and push the names onto the stack whose
name is "SHREE". Also, pop the names from the stack and display the
content of the stack.
SOURCE CODE:
def push_names_to_stack(names, stack):
for name in names:
if name == "SHREE":
[Link](name)
print(f"Name '{name}' pushed to stack.")
def pop_and_display_stack(stack):
print("Popping and displaying stack contents:")
while stack:
name = [Link]()
print(name)
def main():
stack = []
names = []
print("Enter 10 names:")
for _ in range(10):
name = input()
[Link](name)
while True:
print("\nMenu:")
print("1. Traverse the list and push names 'SHREE' onto the
stack")
print("2. Pop and display the contents of the stack")
print("3. Exit")
choice = input("Enter your choice (1/2/3): ")
if choice == '1':
push_names_to_stack(names, stack)
elif choice == '2':
pop_and_display_stack(stack)
elif choice == '3':
print("Exiting the program.")
break
else:
print("Invalid choice. Please try again.")
if __name__ == "__main__":
main()
Output:
#Program 15
Write a menu-driven program in Python using the table of SQL Query 1 in SQL
File
SOURCE CODE:
import [Link] as mycon
mydb=[Link](host='localhost',database='programfile',user='root',
password='viditmishra')
mycursor=[Link]()
def query1():
[Link]("select eno,name,gender from employee order by
ENO asc") #1st Query
for i in mycursor:
print(i)
def query2():
[Link]("select name from employee where gender='male'
") #2nd Query
for i in mycursor:
print(i)
def query3():
[Link]("select eno , name from employee where DOB
between'1987-01-01' and '1991-12-01' ") #3rd Query
for i in mycursor:
print(i)
def query4():
[Link]("select count(eno) from employee where
gender='female' and DOJ>'1986-01-01' ") #4th Query
for i in mycursor:
print(i)
def query5():
[Link]("select * from employee") #5th Query
for i in mycursor:
print(i)
[Link]("select * from employee")
for i in mycursor:
print(i)
def main():
while True:
print("\nMENU")
print()
print("[Link] display Eno, Name, Gender from the table EMPLOYEE
in ascending order of Eno.")
print("[Link] display the Name of all the MALE employees from
the table EMPLOYEE.")
print("[Link] display the Eno and Name of those employees from
the table EMPLOYEE who are born between '1987-01-01' and '1991-12-
01'.")
print("4. To count and display FEMALE employees who have
joined after '1986-01-01'")
print("[Link] display the contents of table employee.")
print("[Link]")
choice=int(input("enter your choice (1/2/3/4/5/6) "))
if choice==1:
query1()
elif choice==2:
query2()
elif choice==3:
query3()
elif choice==4:
query4()
elif choice==5:
query5()
elif choice==6:
break
else:
print("incorrect choice please choose again from
(1/2/3/4/5/6)")
main()
Output:
#Program 16
Write a menu-driven program in Python using the table of SQL Query 2 in SQL
File
SOURCE CODE:
import [Link] as mycon
mydb=[Link](host='localhost',database='programfile',user='root',
password='viditmishra')
mycursor=[Link]()
def query1():
[Link]("select teachername, periods from periods<25")
#1st Query
for i in mycursor:
print(i)
def query2():
[Link]("select teachername,designation from
school,admin where [Link]=[Link]") #2nd Query
for i in mycursor:
print(i)
def query3():
[Link]("select teachername from school where periods=
(MIN(periods) from school)") #3rd Query
for i in mycursor:
print(i)
def query4():
[Link]("select code, teachername, subject from school
where DOJ> '01/01/1999' ") #4th Query
for i in mycursor:
print(i)
def query5():
[Link]("select * from school")
for i in mycursor:
print(i)
[Link]("select* from admin") #5th Query
for i in mycursor:
print(i)
def main():
while True
print("\nMENU")
print()
print("[Link] display TEACHERNAME, PERIODS of all teachers
whose periods are less than 25")
print("[Link] display TEACHERNAME and DESIGNATION from tables
SCHOOL and ADMIN")
print("[Link] display the TEACHERNAME who have minimum
PERIODS")
print("[Link] display CODE, TEACHERNAME and SUBJECT of all
teachers who have joined the school after 01/01/1999.")
print("[Link] display contents of both the tables."")
print("[Link]")
choice=int(input("enter your choice (1/2/3/4/5/6) "))
if choice==1:
print(query1())
elif choice==2:
print(query2())
elif choice==3:
print(query3())
elif choice==4:
print(query4())
elif choice==5:
print(query5())
elif choice==6:
break
else:
print("incorrect choice please choose again from
(1/2/3/4/5/6)")
main()
Output:
#Program 17
Write a menu-driven program in Python using the table of SQL Query 3 in SQL
File
SOURCE CODE:
import [Link] as mycon
mydb=[Link](host='localhost',database='programfile',user='root',
password='viditmishra')
mycursor=[Link]()
def query1():
[Link]("select FIRST_NAME,LAST_NAME, SUBJECT from
teacher where subject='physics' ") #1st Query
for i in mycursor:
print(i)
def query2():
[Link]("select * from teacher order by LAST_NAME asc")
#2nd Query
for i in mycursor:
print(i)
def query3():
[Link]("select teacher. TID, teacher.FIRST_NAME,
([Link]+ salary. bonus) as TOTAL_salary from teacher join salary
on [Link]=salary. TID where [Link] = 'PGT' ") #3rd
Query
for i in mycursor:
print(i)
def query4():
[Link]("select subject, group_concat(address) as
addresses from teacher group by subject") #4th Query
for i in mycursor:
print(i)
def query5():
[Link]("select FIRST_NAME,LAST_NAME from teacher join
salary on [Link]=[Link] where [Link]>1000") #5th Query
for i in mycursor:
print(i)
def main():
while True:
print("\nMENU")
print()
print("[Link] display FIRST_NAME, LAST_NAME and SUBJECT of all
teachers of PHYSICS Subject.")
print("[Link] display all records in ascending order of
LAST_NAME.")
print("[Link] display TID, firstname , total
salary(salary+bonus) of those teacher whose designation is PGT")
print("[Link] display the address of teachers subject wise")
print("[Link] display first name and last name of those
teachers who have bonus more than 1000")
print("[Link]")
choice=int(input("enter your choice (1/2/3/4/5/6) "))
if choice==1:
print(query1())
elif choice==2:
print(query2())
elif choice==3:
print(query3())
elif choice==4:
print(query4())
elif choice==5:
print(query5())
elif choice==6:
break
else:
print("incorrect choice please choose again from
(1/2/3/4/5/6)")
main()
Output:
#Program 18
Write a menu-driven program in Python using the table of SQL Query 4 in SQL
File
SOURCE CODE:
import [Link] as mycon
mydb=[Link](host='localhost',database='programfile',user='root',
password='viditmishra')
mycursor=[Link]()
def query1():
[Link]("select* from product where price>50 and
price<100") #1st Query
for i in mycursor:
print(i)
def query2():
[Link]("select [Link], [Link],
[Link], [Link] from client, product where
client.P_ID=product.P_ID ") #2nd Query
for i in mycursor:
print(i)
def query3():
[Link]("update product set price=price+10")
for i in mycursor:
print(i)
[Link]("select* from product") #3rd Query
for i in mycursor:
print(i)
def query4():
[Link]("select * from product order by price DESC")
#4th Query
for i in mycursor:
print(i)
def query5():
[Link]("select productname,city from client,product
where client.P_ID=product.P_ID and city='delhi' ") #5th Query
for i in mycursor:
print(i)
def main():
while True:
print("\nMENU")
print()
print("[Link] display the details of the Products whose price
is in the range of 50 to 100(Both values included)")
print("[Link] display the Client name, city from table client
and Product name and price from table product, with their corresponding
matching P_ID.")
print("3. To increase the price of all products by 10.")
print("4. To display the data of table product in descending
order of price.")
print("[Link] display the product name and city of all the
products whose client is in 'DELHI' ")
print("[Link]")
choice=int(input("enter your choice (1/2/3/4/5/6) "))
if choice==1:
print(query1())
elif choice==2:
print(query2())
elif choice==3:
print(query3())
elif choice==4:
print(query4())
elif choice==5:
print(query5())
elif choice==6:
break
else:
print("incorrect choice please choose again from
(1/2/3/4/5/6)")
main()
Output: