0% found this document useful (0 votes)
27 views

Ryan CS Practical 2

The document contains code to analyze text from a file. It defines functions to count words, lines, characters, vowels, consonants and perform other analyses. The code displays menus to choose the different analysis functions and call them.

Uploaded by

moiiifitbituser
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views

Ryan CS Practical 2

The document contains code to analyze text from a file. It defines functions to count words, lines, characters, vowels, consonants and perform other analyses. The code displays menus to choose the different analysis functions and call them.

Uploaded by

moiiifitbituser
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 35

#Name: Ryan Roshan

#Roll no: 21
#Question: 7

def append():

with open("100TEST.txt", "a") as f:


a = "His 32 hundreds, however are the joint-most
alongside Kane\nWilliamson, who will complete 100 Test matches
this week"
f.write(a)

def countDisplay():

c = 0
with open("100TEST.txt", "r") as f:

for i in f:

c += len(i)
print(i.strip())

print("Number of characters =", c)

def cases():
with open("100TEST.txt") as f:

uc = lc = di = wh = nwspc = 0

data = f.read()

for i in data:
if i.isalpha():

if i.isupper():

uc += 1

else:
lc += 1

elif i in "1234567890":
di += 1

elif i == " " or i == "\n" or i == "\t":


wh += 1

else:

nwspc += 1

print("Number of lowercase =", lc)


print("Number of uppercase =", uc)

print("Number of digits =", di)

print("Number of whitespace =", wh)

print("Number of special characters =", nwspc)

def consonantsAndVowels():

with open("100TEST.txt") as f:
data = f.read()

uc = lc = uv = lv = 0

for i in data:
if i.upper() in "AEIOU":
if i.isupper():

uv += 1

else:
lv += 1

elif i.upper() in "BCDFGHJKLMNPQRSTVWXYZ":

if i.isupper():

uc += 1
else:

lc += 1

print("Number of lowercase consonants =", lc)

print("Number of uppercase consonants =", uc)


print("Number of lowercase vowels =", lv)

print("Number of uppercase vowels =", uv)

while True:

print("1. Append")

print("2. Display")
print("3. Count Chara")

print("4. Count vowels and consonants")

print("5. exit program")

ch = int(input("Enter no. of choices: "))

if ch == 1:

append()

elif ch == 2:
countDisplay()

elif ch == 3:

cases()
elif ch == 4:
consonantsAndVowels()

elif ch == 5:

print("Program Terminated")
break

'''

1. Append

2. Display
3. Count Chara

4. Count vowels and consonants

5. exit program

Enter no. of choices: 1


1. Append

2. Display
3. Count Chara

4. Count vowels and consonants

5. exit program

Enter no. of choices: 2


Muthiah Muralidaran has the most dominant bowling record in

the first 100 Test matches of a career - 593 wickets, 49

five-wicket hauls and 14 ten-wicket match hauls, all being

the highest for any player. R Ashwin, who will play his 100th
in Dharamsala, is the only one other than Muralidaran with

500-plus wickets in his career's first 100 Tests. Steven Smith

leads the run-getters charts as he scored 9137 runs at an


average

of 58.95 by the end of his 100th Test, both being the highest.
His 32 hundreds, however are the joint-most alongside Kane

Williamson, who will complete 100 Test matches this weekHis 32


hundreds, however are the joint-most alongside Kane

Williamson, who will complete 100 Test matches this week

Number of characters = 719


1. Append

2. Display

3. Count Chara

4. Count vowels and consonants


5. exit program

Enter no. of choices: 3

Number of lowercase = 518

Number of uppercase = 19
Number of digits = 40

Number of whitespace = 121


Number of special characters = 21

1. Append
2. Display

3. Count Chara

4. Count vowels and consonants

5. exit program
Enter no. of choices: 4

Number of lowercase consonants = 331

Number of uppercase consonants = 18

Number of lowercase vowels = 187


Number of uppercase vowels = 1

1. Append

2. Display

3. Count Chara
4. Count vowels and consonants

5. exit program

Enter no. of choices: 5


Program Terminated
'''
#Name: Ryan Roshan

#Roll no: 21

#Question: 8

def display():

c = 0

with open("100TEST.txt") as f:
for i in f:

print(i.strip())

c += len(i.split())

print("number of words in file =", c)

def count():

the = an = a = 0

with open("100TEST.txt") as f:
for i in f:

for k in i.split():

if k.upper() in "AN":
an += 1

elif k.upper() in "A":

a += 1

elif k.upper() in "THE":


the += 1

print("Number of occurrences of AN:", an)


print("Number of occurrences of A:", a)

print("Number of occurrences of THE:", the)

def countVowel():

c = 0
with open("100TEST.txt") as f:

for i in f:

for k in i.split():

if k[0].upper() in "AEIOU":
c += 1

print("number of words starting with a vowel:", c)

def countwordlength():

c = 0

with open("100TEST.txt") as f:
for i in f:

for k in i.split():
if len(k) <= 6:

c += 1
print("number of words with at most 6 letters:", c)

def countConsonant():

c = 0

with open("100TEST.txt") as f:

for i in f:
for k in i.split():

a = 0

for letter in k:
if letter.upper() in
"BCDFGHJKLMNPQRSTVWXYZ":

a += 1

if a >= 3:
c += 1

print("number of words containing atleast 3 consonants:",


c)

while True:

print("1. Count number of words")

print("2. Count number of occurrences of a, an and the")


print("3. Count number of words starting with a vowel")

print("4. Count number of words containing at most 6


letters")

print("5. Count number of words containing at least 3


consonants")

print("6. Exit program")

ch = int(input("Enter choice: "))

if ch == 1:

display()
elif ch == 2:

count()

elif ch == 3:

countVowel()
elif ch == 4:

countwordlength()

elif ch == 5:

countConsonant()
elif ch == 6:

print("Program terminated")
break

'''
1. Count number of words

2. Count number of occurrences of a, an and the

3. Count number of words starting with a vowel

4. Count number of words containing at most 6 letters


5. Count number of words containing at least 3 consonants

6. Exit program

Enter choice: 1
Muthiah Muralidaran has the most dominant bowling record in

the first 100 Test matches of a career - 593 wickets, 49

five-wicket hauls and 14 ten-wicket match hauls, all being

the highest for any player. R Ashwin, who will play his 100th
in Dharamsala, is the only one other than Muralidaran with

500-plus wickets in his career's first 100 Tests. Steven Smith

leads the run-getters charts as he scored 9137 runs at an


average

of 58.95 by the end of his 100th Test, both being the highest.
His 32 hundreds, however are the joint-most alongside Kane

Williamson, who will complete 100 Test matches this weekHis 32


hundreds, however are the joint-most alongside Kane

Williamson, who will complete 100 Test matches this week

number of words in file = 122


1. Count number of words

2. Count number of occurrences of a, an and the

3. Count number of words starting with a vowel

4. Count number of words containing at most 6 letters


5. Count number of words containing at least 3 consonants

6. Exit program
Enter choice: 2

Number of occurrences of AN: 2

Number of occurrences of A: 0

Number of occurrences of THE: 10


1. Count number of words

2. Count number of occurrences of a, an and the

3. Count number of words starting with a vowel

4. Count number of words containing at most 6 letters


5. Count number of words containing at least 3 consonants

6. Exit program

Enter choice: 3

number of words starting with a vowel: 24


1. Count number of words

2. Count number of occurrences of a, an and the

3. Count number of words starting with a vowel


4. Count number of words containing at most 6 letters
5. Count number of words containing at least 3 consonants

6. Exit program

Enter choice: 4
number of words with at most 6 letters: 88

1. Count number of words

2. Count number of occurrences of a, an and the

3. Count number of words starting with a vowel


4. Count number of words containing at most 6 letters

5. Count number of words containing at least 3 consonants

6. Exit program

Enter choice: 5
number of words containing atleast 3 consonants: 66

1. Count number of words


2. Count number of occurrences of a, an and the

3. Count number of words starting with a vowel

4. Count number of words containing at most 6 letters

5. Count number of words containing at least 3 consonants


6. Exit program

Enter choice: 6

Program terminated

'''
#Name: Ryan Roshan

#Roll no: 21

#Question 9

def display():
lines = 0

with open("100TEST.txt") as f:

for i in f:

print(i.strip())
lines += 1

print("Number of lines in file =", lines)

def countNonVowel():
c = 0

with open("100TEST.txt") as f:

for i in f:

if not (i[0].upper() in "AEIOU"):


c += 1

print("Number of lines not starting with a vowel =", c)


def countWords():

with open("100TEST.txt") as f:
c = 1

for i in f:

print("Number of words in line", c, ":",


len(i.split()))

c += 1

def countAlpha():

with open("100TEST.txt") as f:
c = 1

for i in f:

a = 0

for k in i:
if k.isalpha():

a += 1

print("Number of alphabets in line", c, ":", a)


c += 1

def countDigitsAndSpecial():
with open("100TEST.txt") as f:

c = 1
for i in f:

d = 0
sp = 0

for k in i:

if k.isnumeric():

d += 1
elif not k.isalnum():
sp += 1

print("Number of digits in line", c, ":", d)


print("Number of special characters in line", c,
":", sp)
c += 1

while True:

print("1. Count number of lines in file")

print("2. Count number of lines not starting with a


vowel")

print("3. Count number of words in each line")


print("4. Count number of alphabets in each line")

print("5. Count number of digits and special characters in


each line")

print("6. Exit program")

ch = int(input("Enter choice: "))

if ch == 1:

display()

elif ch == 2:
countNonVowel()

elif ch == 3:

countWords()

elif ch == 4:
countAlpha()

elif ch == 5:

countDigitsAndSpecial()

elif ch == 6:
print("Program Terminated")
break

'''

1. Count number of lines in file

2. Count number of lines not starting with a vowel


3. Count number of words in each line

4. Count number of alphabets in each line

5. Count number of digits and special characters in each line

6. Exit program
Enter choice: 1

Muthiah Muralidaran has the most dominant bowling record in

the first 100 Test matches of a career - 593 wickets, 49


five-wicket hauls and 14 ten-wicket match hauls, all being

the highest for any player. R Ashwin, who will play his 100th

in Dharamsala, is the only one other than Muralidaran with

500-plus wickets in his career's first 100 Tests. Steven Smith


leads the run-getters charts as he scored 9137 runs at an
average

of 58.95 by the end of his 100th Test, both being the highest.

His 32 hundreds, however are the joint-most alongside Kane

Williamson, who will complete 100 Test matches this weekHis 32


hundreds, however are the joint-most alongside Kane

Williamson, who will complete 100 Test matches this week


Number of lines in file = 11

1. Count number of lines in file

2. Count number of lines not starting with a vowel


3. Count number of words in each line

4. Count number of alphabets in each line

5. Count number of digits and special characters in each line

6. Exit program
Enter choice: 2

Number of lines not starting with a vowel = 9


1. Count number of lines in file

2. Count number of lines not starting with a vowel

3. Count number of words in each line

4. Count number of alphabets in each line


5. Count number of digits and special characters in each line

6. Exit program

Enter choice: 3

Number of words in line 1 : 9


Number of words in line 2 : 12

Number of words in line 3 : 9

Number of words in line 4 : 12

Number of words in line 5 : 10


Number of words in line 6 : 10

Number of words in line 7 : 12

Number of words in line 8 : 13


Number of words in line 9 : 9
Number of words in line 10 : 17

Number of words in line 11 : 9

1. Count number of lines in file


2. Count number of lines not starting with a vowel

3. Count number of words in each line

4. Count number of alphabets in each line

5. Count number of digits and special characters in each line


6. Exit program

Enter choice: 4

Number of alphabets in line 1 : 51

Number of alphabets in line 2 : 35


Number of alphabets in line 3 : 45

Number of alphabets in line 4 : 45


Number of alphabets in line 5 : 48

Number of alphabets in line 6 : 44

Number of alphabets in line 7 : 49

Number of alphabets in line 8 : 40


Number of alphabets in line 9 : 46

Number of alphabets in line 10 : 90

Number of alphabets in line 11 : 44

1. Count number of lines in file


2. Count number of lines not starting with a vowel

3. Count number of words in each line

4. Count number of alphabets in each line

5. Count number of digits and special characters in each line


6. Exit program

Enter choice: 5

Number of digits in line 1 : 0


Number of special characters in line 1 : 9
Number of digits in line 2 : 8

Number of special characters in line 2 : 14

Number of digits in line 3 : 2


Number of special characters in line 3 : 12

Number of digits in line 4 : 3

Number of special characters in line 4 : 14

Number of digits in line 5 : 0


Number of special characters in line 5 : 11

Number of digits in line 6 : 6

Number of special characters in line 6 : 13

Number of digits in line 7 : 4


Number of special characters in line 7 : 13

Number of digits in line 8 : 7


Number of special characters in line 8 : 16

Number of digits in line 9 : 2

Number of special characters in line 9 : 11

Number of digits in line 10 : 5


Number of special characters in line 10 : 20

Number of digits in line 11 : 3

Number of special characters in line 11 : 9

1. Count number of lines in file


2. Count number of lines not starting with a vowel

3. Count number of words in each line

4. Count number of alphabets in each line

5. Count number of digits and special characters in each line


6. Exit program

Enter choice: 6

Program Terminated
'''
#Name: Ryan Roshan

#Roll no: 21

#Question 10

import csv

def append():
with open("TEACHER.CSV", "a", newline="") as f:

writer = csv.writer(f)
for i in range(2):

code = int(input("Enter code: "))

name = input("Enter name: ")


subject = input("Enter subject: ")

desig = input("Enter designation: ")

NOP = int(input("Enter number of periods: "))

writer.writerow([code, name, subject, desig, NOP])

def display():
records = 0

with open("TEACHER.CSV") as f:
reader = csv.reader(f)

for i in reader:

print(i)

records += 1
print("Number of records in file:", records)

def search():
code = int(input("Enter code to be searched: "))

found = False

with open("TEACHER.CSV") as f:
reader = csv.reader(f)

for i in reader:

if int(i[0]) == code:

print(i)
found = True

if not found:

print("No such teacher found")

def searchSub():

subs = ["PHYS", "CHEM"]


c = 0

with open("TEACHER.CSV") as f:

reader = csv.reader(f)

for i in reader:
if i[2] in subs:

print(i)

c += 1
if c:

print("Number of PHYS or CHEM teachers:", c)


else:

print("No teachers found")

while True:

print("1. Append 2 records")

print("2. Count and display records")

print("3. search teacher by code")


print("4. search teacher by subject")

print("5. exit")

ch = int(input("Enter choice: "))

if ch == 1:

append()

elif ch == 2:
display()

elif ch == 3:

search()

elif ch == 4:
searchSub()

elif ch == 5:

print("Program Terminated")

break

'''
1. Append 2 records

2. Count and display records


3. search teacher by code

4. search teacher by subject


5. exit

Enter choice: 1

Enter code: 1019

Enter name: NUPUR CHACKO


Enter subject: MATH

Enter designation: PRT

Enter number of periods: 30

Enter code: 1020


Enter name: MANAS KHER

Enter subject: PHYS

Enter designation: PRT

Enter number of periods: 30


1. Append 2 records

2. Count and display records

3. search teacher by code


4. search teacher by subject
5. exit

Enter choice: 2

['1001', 'ADITI JAIN', 'PHYS', 'HOD', '20']


['1002', 'ARUN GARG', 'PHYS', 'PGT', '24 ']

['1003', 'BASHIR KHAN', 'PHYS', 'TGT', '28 ']

['1004', 'CHETAN GUPTA', 'PHYS', 'TGT', '27']

['1005', 'DEEPA GHELOT', 'CHEM', 'HOD', '21 ']


['1006', 'ERIKA JACOB', 'CHEM', 'PGT', '26']

['1007', 'GAURAV SHARMA', 'CHEM', 'TGT', '28']

['1008', 'JEEVAN RAMESH', 'CHEM', 'TGT', '27']

['1009', 'KUNAL GHEI', 'CHEM', 'PRT', '30']


['1010', 'RUPA GULATI', 'ENG', 'HOD', '21']

['1011', 'MANOJ KUMAR', 'ENG', 'PGT', '24']


['1012', 'NAMITA KAUR', 'ENG', 'TGT', '28']

['1013', 'PRATAP SHINDE', 'ENG', 'TGT', '29']

['1014', 'GUARI KAPOOR', 'ENG', 'PRT', '30']

['1015', 'HITESH DESAI', 'MATH', 'HOD', '20']


['1016', 'RAKESH YADAV', 'MATH', 'PGT', '26']

['1017', 'ISHITA DASH', 'MATH', 'TGT', '29 ']

['1018', 'DILIP MATHUR', 'MATH', 'TGT', '27']

['1019', 'NUPUR CHACKO', 'MATH', 'PRT', '30']


['1020', 'MANAS KHER', 'PHYS', 'PRT', '30']

['1019', 'NUPUR CHACKO', 'MATH', 'PRT', '30']

['1020', 'MANAS KHER', 'PHYS', 'PRT', '30']

Number of records in file: 22


1. Append 2 records

2. Count and display records

3. search teacher by code


4. search teacher by subject
5. exit

Enter choice: 3

Enter code to be searched: 1019


['1019', 'NUPUR CHACKO', 'MATH', 'PRT', '30']

['1019', 'NUPUR CHACKO', 'MATH', 'PRT', '30']

1. Append 2 records

2. Count and display records


3. search teacher by code

4. search teacher by subject

5. exit

Enter choice: 4
['1001', 'ADITI JAIN', 'PHYS', 'HOD', '20']

['1002', 'ARUN GARG', 'PHYS', 'PGT', '24 ']


['1003', 'BASHIR KHAN', 'PHYS', 'TGT', '28 ']

['1004', 'CHETAN GUPTA', 'PHYS', 'TGT', '27']

['1005', 'DEEPA GHELOT', 'CHEM', 'HOD', '21 ']

['1006', 'ERIKA JACOB', 'CHEM', 'PGT', '26']


['1007', 'GAURAV SHARMA', 'CHEM', 'TGT', '28']

['1008', 'JEEVAN RAMESH', 'CHEM', 'TGT', '27']

['1009', 'KUNAL GHEI', 'CHEM', 'PRT', '30']

['1020', 'MANAS KHER', 'PHYS', 'PRT', '30']


['1020', 'MANAS KHER', 'PHYS', 'PRT', '30']

Number of PHYS or CHEM teachers: 11

1. Append 2 records

2. Count and display records


3. search teacher by code

4. search teacher by subject

5. exit
Enter choice: 5
Program Terminated

'''
#Name: Ryan Roshan

#Roll no: 21
#Question 11

import csv

def searchDesig():
desigs = ["TGT", "PGT"]

c = 0

with open("TEACHER.CSV") as f:

reader = csv.reader(f)
for i in reader:

if i[3] in desigs:

print(i)
c += 1

if c:
print("Number of TGT or PGT teachers:", c)

else:

print("No teachers found")

def searchSubNOP():

c = 0

with open("TEACHER.CSV") as f:
reader = csv.reader(f)

for i in reader:

if i[2] == "MATH" and int(i[4]) > 24:


print(i)

c += 1

if c:

print("Number of Maths teachers with more than 24


periods:", c)
else:

print("No teachers found")

def update():

f1 = open("TEACHER.CSV", "r")
reader = csv.reader(f1)

c = 0
l = []

for k in reader:

i = list(k)

i[4] = int(i[4])
if i[3] == "PRT":
i[4] += 3

c += 1
l.append(i)

print(c, "records updated")

f1.close()

f2 = open("TEACHER.CSV", "w", newline="")


writer = csv.writer(f2)

writer.writerows(l)

f2.close()

def delete():

code = int(input("Enter code to delete: "))

f1 = open("TEACHER.CSV")

reader = csv.reader(f1)
deleted = []

for row in reader:


if int(row[0]) == code:

deleted.append(row)
f1.close()

f2 = open("TEACHER.CSV", "w", newline="")

writer = csv.writer(f2)

for row in deleted:

writer.writerow(row)
f2.close()

while True:

print("1. Display PGT and TGP")


print("2. Search by subject")

print("3. Update a record by increasing NOP of every PRT")


print("4. Delete a record containing inputted code ")

print("5. Exit")

ch = int(input("Enter choice: "))

if ch == 1:

searchDesig()

elif ch == 2:

searchSubNOP()
elif ch == 3:

update()

elif ch == 4:

delete()
elif ch == 5:

print("Program Terminated")
break

'''

1. Display PGT and TGP


2. Search by subject

3. Update a record by increasing NOP of every PRT

4. Delete a record containing inputted code

5. Exit
Enter choice: 1

['1002', 'ARUN GARG', 'PHYS', 'PGT', '24']

['1003', 'BASHIR KHAN', 'PHYS', 'TGT', '30']

['1004', 'CHETAN GUPTA', 'PHYS', 'TGT', '29']


['1006', 'ERIKA JACOB', 'CHEM', 'PGT', '26']

['1007', 'GAURAV SHARMA', 'CHEM', 'TGT', '30']


['1008', 'JEEVAN RAMESH', 'CHEM', 'TGT', '29']

['1011', 'MANOJ KUMAR', 'ENG', 'PGT', '24']

['1012', 'NAMITA KAUR', 'ENG', 'TGT', '30']

['1013', 'PRATAP SHINDE', 'ENG', 'TGT', '31']


['1016', 'RAKESH YADAV', 'MATH', 'PGT', '26']

['1017', 'ISHITA DASH', 'MATH', 'TGT', '31']

['1018', 'DILIP MATHUR', 'MATH', 'TGT', '29']

Number of TGT or PGT teachers: 12


1. Display PGT and TGP

2. Search by subject

3. Update a record by increasing NOP of every PRT

4. Delete a record containing inputted code


5. Exit

Enter choice: 2

['1016', 'RAKESH YADAV', 'MATH', 'PGT', '26']


['1017', 'ISHITA DASH', 'MATH', 'TGT', '31']
['1018', 'DILIP MATHUR', 'MATH', 'TGT', '29']

Number of Maths teachers with more than 24 periods: 3

1. Display PGT and TGP


2. Search by subject

3. Update a record by increasing NOP of every PRT

4. Delete a record containing inputted code

5. Exit
Enter choice: 3

2 records updated

1. Display PGT and TGP

2. Search by subject
3. Update a record by increasing NOP of every PRT

4. Delete a record containing inputted code


5. Exit

Enter choice: 4

Enter code to delete: 1018

1. Display PGT and TGP


2. Search by subject

3. Update a record by increasing NOP of every PRT

4. Delete a record containing inputted code

5. Exit
Enter choice: 5

Program Terminated

'''
#Name: Ryan Roshan

#Roll no: 21
#Question 12

import csv
import os

def searchTeacher():

name = input("Enter teacher's name: ")

f = open('TEACHER.CSV', 'r')

reader = csv.reader(f)
for row in reader:

if row[1] == name:

print("Teacher's details:", row)

f.close()
return

f.close()
print("Teacher not found.")

def displayMathTgt():

count = 0
f = open('TEACHER.CSV', 'r')

reader = csv.reader(f)

for row in reader:

if row[2] == 'MATH' and row[3] == 'TGT':


print("Teacher's details:", row)

count += 1

f.close()

print("Number of records found:", count)


def updateNop():

f = open('TEACHER.CSV', 'r')

f2 = open('temp.csv', 'w', newline='')

reader = csv.reader(f)
writer = csv.writer(f2)

for row in reader:

if row[3] == 'TGT':

row[4] = str(int(row[4]) + 2)
writer.writerow(row)

f.close()

f2.close()
os.remove('TEACHER.CSV')

os.rename('temp.csv', 'TEACHER.CSV')

print("NOP updated for all TGTs.")

def deleteHod():
f = open('TEACHER.CSV', 'r')

f2 = open('temp.csv', 'w', newline='')


reader = csv.reader(f)

writer = csv.writer(f2)

for row in reader:


if row[3] != 'HOD':

writer.writerow(row)

f.close()

f2.close()
os.remove('TEACHER.CSV')

os.rename('temp.csv', 'TEACHER.CSV')

print("All HOD records deleted.")


while True:

print("1. Search for teacher")

print("2. Display MATH TGT details")

print("3. Update NOP for TGTs")


print("4. Delete HOD records")

print("5. Exit")

ch = input("Enter your choice: ")

if ch == '1':
searchTeacher()

elif ch == '2':

displayMathTgt()
elif ch == '3':

updateNop()

elif ch == '4':

deleteHod()
elif ch == '5':

break

'''

1. Display PGT and TGP

2. Search by subject
3. Update a record by increasing NOP of every PRT

4. Delete a record containing inputted code

5. Exit

Enter choice: 1
['1002', 'ARUN GARG', 'PHYS', 'PGT', '24']

['1003', 'BASHIR KHAN', 'PHYS', 'TGT', '28']

['1004', 'CHETAN GUPTA', 'PHYS', 'TGT', '27']


['1006', 'ERIKA JACOB', 'CHEM', 'PGT', '26']

['1007', 'GAURAV SHARMA', 'CHEM', 'TGT', '28']


['1008', 'JEEVAN RAMESH', 'CHEM', 'TGT', '27']

['1011', 'MANOJ KUMAR', 'ENG', 'PGT', '24']

['1012', 'NAMITA KAUR', 'ENG', 'TGT', '28']

['1013', 'PRATAP SHINDE', 'ENG', 'TGT', '29']


['1016', 'RAKESH YADAV', 'MATH', 'PGT', '26']

['1017', 'ISHITA DASH', 'MATH', 'TGT', '29']

['1018', 'DILIP MATHUR', 'MATH', 'TGT', '27']

Number of TGT or PGT teachers: 12


1. Display PGT and TGP

2. Search by subject

3. Update a record by increasing NOP of every PRT

4. Delete a record containing inputted code


5. Exit

Enter choice: 2

['1016', 'RAKESH YADAV', 'MATH', 'PGT', '26']


['1017', 'ISHITA DASH', 'MATH', 'TGT', '29']
['1018', 'DILIP MATHUR', 'MATH', 'TGT', '27']

Number of Maths teachers with more than 24 periods: 3

1. Display PGT and TGP


2. Search by subject

3. Update a record by increasing NOP of every PRT

4. Delete a record containing inputted code

5. Exit
Enter choice: 3

2 records updated

1. Display PGT and TGP

2. Search by subject
3. Update a record by increasing NOP of every PRT

4. Delete a record containing inputted code


5. Exit

Enter choice: 4

Enter code to delete: 1018

1. Display PGT and TGP


2. Search by subject

3. Update a record by increasing NOP of every PRT

4. Delete a record containing inputted code

5. Exit
Enter choice: 4

Enter code to delete: 1017

1. Display PGT and TGP

2. Search by subject
3. Update a record by increasing NOP of every PRT

4. Delete a record containing inputted code

5. Exit
Enter choice: 5
Program Terminated

'''

You might also like