The document contains the practical file of a class 12 student named Yashraj Pahuja. It includes 20 questions related to Python programming and functions. For each question, the student has provided the question, written code to solve it, and sometimes included the output. The practical file covers topics like loops, sorting algorithms, number checking functions, file handling operations, and CSV/binary file management using functions.
CBSE Class 12 Computer practical Python Programs and MYSQL Rishabh-Rawat
This upload is my Computer Science Practical File for CBSE class 12 Board exam practical.
Some errors in the displaying of the content might have crept in as I prepared this file on my android. ;P
import java.util.Scanner;Henry Cutler ID 1234 7202.docxwilcockiris
import java.util.Scanner;
/*
Henry Cutler ID 1234 7/20/2015
Assignment #5, 3 features in 1 program
Solution
for Assignment#5 COP2800
Pseudocode:
Program has three features, all in a single program that are user selectable.
Prompt with options and get user choice inside a while statement ( true )
If 1 is entered:
Using a while and for loop, print out the ASCII table from ! to ~.
If 2 is entered:
Prompt the user for number of times to flip for head or tails using the random method. Count number of each and when the request times are done, print out the results.
If 3 is entered:
Prompt the user for a strings and print back the count of vowels and letters
Any other input entered program will exit using a break statement, otherwise loops back to prompt user for feature selection.
*/
public class Module5 {
public static void main(String[] args) {
// prompt the user
System.out.println("Welcome to Henry\'s 3 in 1 Programming Assignment for Module 5\n");
// create Scanner Object
Scanner input = new Scanner(System.in);
// loop until break
while(true){
// new lines for readability
System.out.print("\n");
// Prompt user for choices
System.out.print("Enter 1 for ASCII Table \nEnter 2 for Heads or Tails\nEnter 3 for Count Vowels & Letters\nAny other input will exit");
int choice = input.nextInt();
// Consume newline left-over
input.nextLine();
// first feature
if(choice == 1){
// start value is !
int value = (int) '!';
// newline for formating
System.out.println("You Selected ASCII Table!\n");
// start at ~ which is 33 decimal
while( value <= '~')
{
// print out 20 in a line
for( int count = 0; count < 20; count ++ ){
if( value <= '~'){
// print single value
System.out.print( (char) value++ );
}
else {
// break when we are at last char to print
break;
}
}
// New line every 10
System.out.print("\n");
}
// New line at exit
System.out.print("\n");
}
else if(choice == 2){
// Prompt user
System.out.println("You Selected Head or Tails!");
System.out.println("\nHow many flips would you like to try?");
// get value
int count = input.nextInt();
// clear
input.nextLine();
int headCount = 0;
int tailCount = 0;
// run for a count provided by user
for (int i = 0; i < count; i++) {
// get random number
if (Math.random() > 0.5){
// increment heads
headCount++;
}
else {
// increment tails
tailCount++;
}
}
System.out.println("Head count: " + headCount + " tail count: " + tailCount);
}
else if(choice == 3){
// Prompt user
Sys.
CBSE Class 12 Computer practical Python Programs and MYSQL Rishabh-Rawat
This upload is my Computer Science Practical File for CBSE class 12 Board exam practical.
Some errors in the displaying of the content might have crept in as I prepared this file on my android. ;P
import java.util.Scanner;Henry Cutler ID 1234 7202.docxwilcockiris
import java.util.Scanner;
/*
Henry Cutler ID 1234 7/20/2015
Assignment #5, 3 features in 1 program
Solution
for Assignment#5 COP2800
Pseudocode:
Program has three features, all in a single program that are user selectable.
Prompt with options and get user choice inside a while statement ( true )
If 1 is entered:
Using a while and for loop, print out the ASCII table from ! to ~.
If 2 is entered:
Prompt the user for number of times to flip for head or tails using the random method. Count number of each and when the request times are done, print out the results.
If 3 is entered:
Prompt the user for a strings and print back the count of vowels and letters
Any other input entered program will exit using a break statement, otherwise loops back to prompt user for feature selection.
*/
public class Module5 {
public static void main(String[] args) {
// prompt the user
System.out.println("Welcome to Henry\'s 3 in 1 Programming Assignment for Module 5\n");
// create Scanner Object
Scanner input = new Scanner(System.in);
// loop until break
while(true){
// new lines for readability
System.out.print("\n");
// Prompt user for choices
System.out.print("Enter 1 for ASCII Table \nEnter 2 for Heads or Tails\nEnter 3 for Count Vowels & Letters\nAny other input will exit");
int choice = input.nextInt();
// Consume newline left-over
input.nextLine();
// first feature
if(choice == 1){
// start value is !
int value = (int) '!';
// newline for formating
System.out.println("You Selected ASCII Table!\n");
// start at ~ which is 33 decimal
while( value <= '~')
{
// print out 20 in a line
for( int count = 0; count < 20; count ++ ){
if( value <= '~'){
// print single value
System.out.print( (char) value++ );
}
else {
// break when we are at last char to print
break;
}
}
// New line every 10
System.out.print("\n");
}
// New line at exit
System.out.print("\n");
}
else if(choice == 2){
// Prompt user
System.out.println("You Selected Head or Tails!");
System.out.println("\nHow many flips would you like to try?");
// get value
int count = input.nextInt();
// clear
input.nextLine();
int headCount = 0;
int tailCount = 0;
// run for a count provided by user
for (int i = 0; i < count; i++) {
// get random number
if (Math.random() > 0.5){
// increment heads
headCount++;
}
else {
// increment tails
tailCount++;
}
}
System.out.println("Head count: " + headCount + " tail count: " + tailCount);
}
else if(choice == 3){
// Prompt user
Sys.
Md university cmis 102 week 4 hands on lab newLast7693
cmis 102 homework 4 create your own function new,cmis 102 week 4 hands on lab new,cmis 102 stage 4 final system report precision electronic parts new,md university cmis 102,cmis 102,md university cmis 102 week 4 tutorial,cmis 102 week 4 assignment,md university cmis 102 week 4 help
Google Calendar is a versatile tool that allows users to manage their schedules and events effectively. With Google Calendar, you can create and organize calendars, set reminders for important events, and share your calendars with others. It also provides features like creating events, inviting attendees, and accessing your calendar from mobile devices. Additionally, Google Calendar allows you to embed calendars in websites or platforms like SlideShare, making it easier for others to view and interact with your schedules.
Md university cmis 102 week 4 hands on lab newLast7693
cmis 102 homework 4 create your own function new,cmis 102 week 4 hands on lab new,cmis 102 stage 4 final system report precision electronic parts new,md university cmis 102,cmis 102,md university cmis 102 week 4 tutorial,cmis 102 week 4 assignment,md university cmis 102 week 4 help
Google Calendar is a versatile tool that allows users to manage their schedules and events effectively. With Google Calendar, you can create and organize calendars, set reminders for important events, and share your calendars with others. It also provides features like creating events, inviting attendees, and accessing your calendar from mobile devices. Additionally, Google Calendar allows you to embed calendars in websites or platforms like SlideShare, making it easier for others to view and interact with your schedules.
Building a Raspberry Pi Robot with Dot NET 8, Blazor and SignalR - Slides Onl...Peter Gallagher
In this session delivered at Leeds IoT, I talk about how you can control a 3D printed Robot Arm with a Raspberry Pi, .NET 8, Blazor and SignalR.
I also show how you can use a Unity app on an Meta Quest 3 to control the arm VR too.
You can find the GitHub repo and workshop instructions here;
https://bit.ly/dotnetrobotgithub
2. INDEX
S.
No.
Practical Date Signature
1 Any two patterns using nested for loop up to n
times where n is input by the user.
24 April 2023
2 Implement bubble sort using UDF on a list input by
the user.
24 April 2023
3 Implement insertion sort using UDF on a list input
by the user.
24 April 2023
4 Write python code which uses a UDF
‘check_perfect’ that takes ‘n’ as a parameter and
checks whether ‘n’ is a perfect number or not.
24 April 2023
5 Write python code which uses UDF
‘check_armstrong’ that takes a parameter ‘n’ and
checks whether ‘n’ is an armstrong number or not.
24 April 2023
6 Write python code which creates a menu for the
following options :
1. Check whether number is perfect or not
2. Check whether number is armstrong or not
3. Display prime numbers from the list
4. Check whether list is sparse or not
5. Exit
11 May 2023
7 30 May 2023
8 30 May 2023
9 30 May 2023
10 30 May 2023
11 30 May 2023
12 Write python code which uses UDF 'add_recirds()'
to add the records of employees where each
employee contains employee number, name,
salary and department. Ask the data from the user
till the user wishes and store all the records in
'employee.dat' file. Write function 'display_record()'
which reads the record of binary file employee.dat
and displays it.
14 July 2023
3. 13 Create a menu driven program to input the details
of a voter including voter ID, voter name, age,
address.
1. Create a binary file 'Voter.dat'
2. Read the records of the binary file and
display them.
3. Search for the voters whose age is above
60 and display them.
Use UDF to perform the above functions.
14 July 2023
14 Write a menu driven program which performs a
specific operation on CSV file 'employee.csv' which
contains employee number, name, salary and
designation.
1. Create a file
2. Display the records
3. Search for employee number
4. Search for salary
5. Exit
31 July 2023
15 Write python code which create a 'voter.csv' file
and using UDF, perform the following operations
1. Create 'voter.csv' file. (Voter ID, name, age,
address)
2. Display the records of voters with age
above 60.
3. Display records of voters who stay in
Rajouri garden with age above 21.
31 July 2023
16 Write python code which uses UDF 'count()' that
takes filename as parameter and returns the count
of lines in the file beginning with letter 'T'.
7 August
2023
17 Write python code which uses function
'count_words()' that read the contents of the file
'story.txt' and display the number of words from the
file.( If the file is not created then the program
creates the file.)
7 August
2023
18 A binary file 'grade.dat' is required to be created by
inputting records from the user. Perform the
following operations using UDF. (Admission
number, Name, marks, grade)
1. Create the binary file 'great.dat' by inputting
records from the user till user wishes
2. Display the records of the students who
have secured more than 90 marks
7 August
2023
4. 3. Update the grade of the student whose
name is input by the user from B grade to A
grade.
4. Display all the records
19 Write python code which create a CSV file
'inventory.csv' containing item quote, item name,
company, price and quantity. Use UDF to perform
the following operations.
1. Create the CSV file (Till the user wish)
2. Display all the records of the CSV file.
3. Display the details of those items whose
price is more than 40,000.
7 August
2023
20 Write python code which implements stack as a list
containing details of a customer having customer
name, phone no, and city. The menu driven
program should provide option 1. Push, 2. Pop, 3.
Display. The program should continue till the user
wishes, taking care of all the validations.
23 August
2023
21 Write python code which creates a menu
implementing user defined functions on a CSV file.
1. Create a CSV file by writing 1 record at a
time.
2. Write multiple records in one go.
3. Display the records of the CSV file.
4. Display the records of employee with salary
input by the user.
5. Exit
The CSV file contains employee no, name,
designation, salary and age.
23 August
2023
22 Write python code that uses UDF ‘create_file()’ that
creates a text file with inputs from the user. The
program/function displays the number of uppercase
vowels, lowercase vowels, number of words
starting with ‘A’ and number of lines starting with
‘A’.
1 September
2023
5. Q1. Any two patterns using nested for
loop upto n times where n is input by the
user?
Ans1.
n=int(input("enter the number"))
for i in range (1,n):
for j in range (1,6):
print ("*",end=" ")
print()
Ans2.
n=int(input("enter the number"))
for i in range (1,n):
for j in range (1,8):
print (j,end=" ")
print ()
6. Q2. Implement bubble sort using UDF on
a list input by the user.
Ans2.
def bubble_sort(l):
n = len(l)
for i in range (0,n):
for j in range(n-i-1):
if l[j]> l[j+1]:
l[j],l[j+1] = l[j+1], l[j]
return l
l = []
k = int (input("enter the limit"))
for i in range (0,k):
val = int(input("enter numbers "))
l.append(val)
f = bubble_sort(l)
print(f)
8. Q4. Write python code which uses a UDF
‘check_perfect’ that takes ‘n’ as a
parameter and checks whether ‘n’ is a
perfect number or not.
Ans.
def check(n):
sum=0
for i in range(1,n):
if n%i==0:
sum=sum+i
if sum==n:
print("it is a perfect number")
else:
print("it is not a perfect number")
n=int(input("enter the number"))
check(n)
9. Q5. Write python code which uses UDF
‘check_armstrong’ that takes a parameter
‘n’ and checks whether ‘n’ is an armstrong
number or not.
Ans.
Output-
10. : Q6. Write python code which creates a
menu for the following options
1.Check whether number is perfect or not
2.Check whether number is armstrong or not
3.Display prime numbers from the list
4.Check whether list is sparse or not
5.Exit
def check_perfect():
x=int(input("enter the number:"))
sum=0
for i in range(1,x):
if x%i==0:
sum+=i
if sum==x:
print(x,"perfect number")
else:
print(x,"not a perfect number")
def check_amstrong():
n=int(input("enter the number"))
f=n
r=n
while f>n:
digit=f%10
r=r+(digit**3)
f=f//10
if r==n:
11. print("number is amstrong")
else:
print("number is not amstrong")
def prime():
m=list()
k=int(input("enter the size of list"))
c=list()
for i in range(0,k):
val=int(input("enter the value"))
m.append(val)
for j in m:
ctr=0
for s in range(1,j+1):
if j%s==0:
ctr=+1
if ctr==2:
c.append(j)
print(c)
def sparse():
l=list()
n=int(input("enter the size of list"))
for i in range(0,n):
val=int(input("enter the valeu"))
l.append(V)
ctrA=0
ctrB=0
for v in i:
if v==0:
ctrA+=1
12. elif v!=0:
ctrB+=1
if ctrA>ctrB:
print("list is sparse")
else:
print("list is not sparse")
def exit():
print("exit")
choice='y'
while choice in 'y':
print("the options are:")
print("#1.check number is perfect or not")
print("#2.check whether number us amstrong or
not")
print("#3.display prime number from the list")
print("#4.check whether no is sparse or not")
print("#5.exit")
ch=int(input("enter your choice"))
if ch==1:
check_perfect()
elif ch==2:
check_amstrong()
elif ch==3:
prime()
elif ch==4:
sparse()
elif ch==5:
exit()
else:
14. Q)7write python code which reads from the
text file school.txt and display the contents
line wise.
Ans.
OUTPUT-
15. Q8)write python code which read from the
text file YASHRAJ HERE WANNA SEE ME
.HAHAHAHAHA.txt and display those lines
which start from ‘H’
Ans.
OUTPUT-
16. Q9)write python code which reads lines
from the text file story.txt and count the
number of lines beginning with an upper
case vowel.
ANS.
f1=open("story.txt","r")
lines=f1.readlines()
ctr=0
for i in lines:
if i[0]in'AEIOU':
ctr+ctr+1
print(ctr)
17. Q10)write python code which read lines
from the text file story .txt and display those
lines whose length is more than 10
characters
Ans.
OUTPUT-
18. Q11)write python code which creates a file
paragraph.txt and count the number of
words having length exactly five.
Ans.
f1=open("paragraph.txt","w")
ch="y"
while ch in "yY":
string=input("enter lines of data")
f1.write(string+"/n")
ch=input("do you want to add more")
f1.close()
f2=open("paragraph.txt","r")
ctr=0
data=f2.read()
words=data.split()
for w in words:
if len(w)==5:
ctr=ctr+1
print(ctr)
19. Q12. Write python code which uses UDF
'add_recirds()' to add the records of employees
where each employee contains employee number,
name, salary and department. Ask the data from
the user till the user wishes and store all the
records in 'employee.dat' file. Write function
'display_record()' which reads the record of binary
file employee.dat and displays it.
Ans.
21. Q13. Create a menu driven program to
input the details of a voter including voter
ID, voter name, age, address.
1. Create a binary file 'Voter.dat'
2. Read the records of the binary file
and display them.
3. Search for the voters whose age is
above 60 and display them.
Ans.
import pickle
def add_records():
f1=open("voter.dat",'wb')
rec=[]
choice='y'
while choice in 'Yy':
vid=int(input("Enter voter ID : "))
name=input("Enter name : ")
age=float(input("Enter age : "))
add=input("Enter address : ")
L=[vid, name, age, add]
rec.append(L)
choice=input("Do you want to add more records
?(y/n)")
pickle.dump(rec,f1)
f1.close()
def display_record():
24. Q14. Write a menu driven program which
performs a specific operation on CSV file
'employee.csv' which contains employee
number, name, salary and designation.
1. Create a file
2. Display the records
3. Search for employee number
4. Search for salary
5. Exit
Ans.
import csv
choice='y'
while choice in 'Yy':
print("The options are: ")
print("1. Enter new records.")
print("2. Display records.")
print("3. Search for employee number.")
print("4. Search for salary")
print("5. Exit")
k=int(input("Enter your choice: "))
25. if k==1:
f1=open("employee.csv",'w')
c1=csv.writer(f1)
L=['Employee no.', 'Name', 'Salary',
'Designation']
c1.writerow(L)
choice='y'
while choice in 'Yy':
eno=int(input("Enter employee
number : "))
name=input("Enter name : ")
sal=float(input("Enter salary : "))
des=input("Enter designation : ")
L=[eno, name, sal, des]
c1.writerow(L)
choice=input("Do you want to add
more records ?(y/n)")
f1.close()
elif k==2:
f2=open("employee.csv",'r')
c1=csv.reader(f2)
for rec in c1:
26. if rec!=[]:
print(rec)
elif k==3:
s=int(input("Enter employee number :
"))
f3=open('employee.csv','r')
c2=csv.reader(f3)
next(c2)
for row in c2:
if row!=[] and int(row[0])==s:
print(row)
elif k==4:
t=int(input("Enter salary : "))
L2=[]
f4=open('employee.csv','r')
c3=csv.reader(f4)
next(c3)
for rec in c3:
if rec!=[] and float(rec[2])==t:
print(rec)
elif k==5:
break
28. Q15. Write python code which create a
'voter.csv' file and using UDF, perform the
following operations
1. Create 'voter.csv' file. (Voter ID,
name, age, address)
2. Display the records of voters with
age above 60.
3. Display records of voters who stay
in Rajouri garden with age above 21.
Ans.
import csv
def add():
f1=open("voter.csv",'w')
c1=csv.writer(f1)
L=['Voter ID', 'Name', 'Age', 'Address']
c1.writerow(L)
choice='y'
while choice in 'Yy':
vid=int(input("Enter Voter ID : "))
name=input("Enter name : ")
add=input("Enter address : ")
age=int(input("Enter age : "))
L=[vid, name, age, add]
c1.writerow(L)
choice=input("Do you want to add more records ?(y/n)")
f1.close()
def search1():
f2=open("voter.csv",'r')
c2=csv.reader(f2)
next(c2)
for rec in c2:
if rec!=[] and int(rec[2])>60:
print(rec)
def search2():
f3=open('voter.csv','r')
c3=csv.reader(f3)
29. next(c3)
for rec in c3:
if rec!=[] and rec[3]=="Rajouri Garden" and int(rec[2])<21:
print(rec)
choice='y'
while choice in 'Yy':
print("The options are: ")
print("1. Enter new records.")
print("2. Display records of voters with age above 60.")
print("3. Display records of voters who stay in Rajouri garden with age above 21.")
print("4. Exit")
k=int(input("Enter your choice: "))
if k==1:
add()
elif k==2:
search1()
elif k==3:
search2()
elif k==4:
break
choice=input("Do you want to continue? (y/n)")
Output
30.
31. Q.16 write python code which uses UDF
"count()" that takes one parameters
filename and returns the count of lines in
the file beginning with letter "T"
Ans.
fv=open('letsgo.txt','w')
l=int(input("How many lines do you want in the file? "))
for i in range(0, l):
t= input("Write the line you want to enter in the file: ")
fv.write(t + "n")
fv.close()
def count(filename):
with open(filename, 'r') as file:
lines = file.readlines()
count = 0
for line in lines:
count += 1
return count
filename = 'letsgo.txt'
line_count = count(filename)
print("The number of lines starting with 'T' in {filename}
is:", line_count)
32. Q.17 Write python code which uses
function “count words( )” that reads the
contents of the file "string.txt" and display
the number of words from the file . If file is
not created then the program creates the
file
Ans.
def count_words():
ctr=0
f1=open("Story.txt",'r')
data=f1.read()
w=data.split()
for i in w :
ctr=ctr+1
print("No. of words are : ", ctr)
count_words()
33. Q18. A binary file 'grade.dat' is
required to be created by inputting
records from the user. Perform the
following operations using UDF.
(Admission number, Name, marks,
grade)
1. Create the binary file 'great.dat'
by inputting records from the user
till user wishes
2. Display the records of the
students who have secured more
than 90 marks
3. Update the grade of the student
whose name is input by the user
from B grade to A grade.
Display all the records.
Ans.
import pickle
def add():
f1=open("grade.dat",'ab')
rec=[]
choice='y'
34. while choice in 'Yy':
add=int(input("Enter admission no. : "))
name=input("Enter name : ")
mark=float(input("Enter marks : "))
gra=input("Enter grade : ")
L=[add, name, mark, gra]
rec.append(L)
choice=input("Do you want to add more records
?(y/n)")
pickle.dump(rec,f1)
f1.close()
def search():
f2=open("grade.dat",'rb')
data=pickle.load(f2)
for d in data:
if d[2]>90:
print(d)
def update():
n=input("Enter the name of student : ")
f3=open("grade.dat",'rb+')
data=pickle.load(f3)
for d in data:
if d[1]==n:
d[3]='A'
f3.seek(0)
pickle.dump(data,f3)
f3.close()
def display():
with open("grade.dat",'rb')as f4:
35. data=pickle.load(f4)
for rec in data:
print(rec)
choice='y'
while choice in 'Yy':
print("The options are: ")
print("1. Enter new records.")
print("2. Display records of students who have scored
above 90 marks.")
print("3. Update grade of students from B to A.")
print("4. Display all records")
k=int(input("Enter your choice: "))
if k==1:
add()
elif k==2:
search()
elif k==3:
update()
elif k==4:
display()
else:
print("INVALID CHOICE")
choice=input("Do you want to continue? (y/n)")
36.
37. Q19. Write python code which create a
CSV file 'inventory.csv' containing item
quote, item name, company, price and
quantity. Use UDF to perform the
following operations.
1. Create the CSV file (Till the user
wish)
2. Display all the records of the CSV
file.
3. Display the details of those items
whose price is more than 40,000.
Ans.
import csv
def add():
f1=open("inventory.csv",'a')
c1=csv.writer(f1)
L=['Item quote', 'Item name', 'Company', 'Price', 'Quantity']
c1.writerow(L)
choice='y'
while choice in 'Yy':
iq=float(input("Enter Item quote: "))
name=input("Enter Item name : ")
com=input("Enter company : ")
pr=float(input("Enter price : "))
qu=int(input("Enter quantity : "))
L=[iq, name, com, pr, qu]
c1.writerow(L)
choice=input("Do you want to add more records ?(y/n)")
f1.close()
def display():
f2=open("inventory.csv",'r')
38. c2=csv.reader(f2)
next(c2)
for rec in c2:
if rec!=[]:
print(rec)
def search():
f3=open('inventory.csv','r')
c3=csv.reader(f3)
next(c3)
for rec in c3:
if rec!=[] and float(rec[3])>40000:
print(rec)
choice='y'
while choice in 'Yy':
print("The options are: ")
print("1. Enter new records.")
print("2. Display records.")
print("3. Display details of those items whose price is above 40000.")
k=int(input("Enter your choice: "))
if k==1:
add()
elif k==2:
display()
elif k==3:
search()
choice=input("Do you want to continue? (y/n)")
39.
40. Q20. Write python code which implement
stack as a list containing details of a
customer having customer name, phone
no, and city. The menu driven program
should provide the option 1. Push, 2. Pop,
3. Display. The program should continue
till the user wishes, taking care of all the
validations.
Ans.
stack=[]
choice='y'
while choice in 'Yy':
print("1.Push")
print("2.Pop")
print("3.Display")
print("4.Exit")
ch=int(input("Enter you choice : "))
if ch==1:
name=input("Enter you name : ")
no=int(input("Enter phone no. : "))
city=input("Enter city : ")
det=[name, no, city]
stack.append(det)
elif ch==2:
if stack==[]:
print("Stack underflow")
42. Q21. Write python code which creates a
menu implementing user defined functions
on CSV file.
1. Create a CSV file by writing 1
record at a time.
2. Write multiple records in one go.
3. Display the records of the CSV file.
4. Display the records of employ with
salary input by the user.
5. Exit
The CSV file contains employee no,
name, designation, salary
Ans.
import csv
def add():
f1=open("employees.csv",'w')
c1=csv.writer(f1)
L=['Employee no.', 'Name', 'Designation', 'Salary',
'Age']
c1.writerow(L)
choice='y'
while choice in 'Yy':
eno=int(input("Enter employee number : "))
name=input("Enter name : ")
sal=float(input("Enter salary : "))
43. des=input("Enter designation : ")
age=int(input("Enter age : "))
L=[eno, name, des, sal, age]
c1.writerow(L)
choice=input("Do you want to add more records
?(y/n)")
f1.close()
def display():
f2=open("employees.csv",'r')
c2=csv.reader(f2)
for rec in c2:
if rec!=[]:
print(rec)
def search():
t=int(input("Enter salary : "))
f3=open('employees.csv','r')
c3=csv.reader(f3)
next(c3)
for rec in c3:
if rec!=[] and float(rec[3])==t:
print(rec)
choice='y'
while choice in 'Yy':
print("The options are: ")
print("1. Enter new records.")
print("2. Display records.")
print("3. Search for salary")
print("4. Exit")
k=int(input("Enter your choice: "))