Set 4 - CSV
Set 4 - CSV
a. Display the details of the trainer who joined before june 2001 and after dec2001
b. Display the name and salary of the trainer who belongs to Mumbai and Delhi
c. Increase the salary by 5% for the trainers who’s name ends with A and from Mumbai
d. To display total number of trainers whose salary is more than 75000.
def display_record():
f=open("telephone.csv",'r')
ro=csv.reader(f)
l=list(ro)
for i in range(1,len(l)):
print(l[i])
f.close()
def search_record():
f=open("telephone.csv","r")
ro=csv.reader(f)
sid=input("Enter id to search:")
found=0
for i in ro:
if sid==i[0]:
found=1
print("Record Found:")
print(i)
if found==0:
print("Record not found...")
f.close()
def menu():
while True:
print('''
1. Add record
2. Display record
3. Search record
4. Exit
''')
ch=int(input("Enter your choice:"))
if ch==1:
add_record()
elif ch==2:
display_record()
elif ch==3:
search_record()
elif ch==4:
print("Over and exit!!")
break
else:
print("Invalid Choice")
menu()
SQL
a. Display the details of the trainer who joined before june 2001 and after dec2001
b. Display the name and salary of the trainer who belongs to Mumbai and Delhi
c. Increase the salary by 5% for the trainers who’s name ends with A and from Mumbai