Professional Documents
Culture Documents
Python Coding
Python Coding
db=con.connect(host="localhost",user="root",passwd="0000",database="school_management_syste
m")
l=["1","2","3","4","5","6","7","8","9","10","11","12"]
you=input("\n Enter the class which you want to check(like-9/10/11/12) or press (a)for all ")
cur=db.cursor()
for i in cur:
n=i[0]
c=i[1]
a=i[2]
ad=i[3]
d=i[4]
p=i[5]
print(f"name= {n} ,\t class= {c} ,\t admission_no= {a} ,\t address= {ad} ,\t date_of_birth= {d} ,\t
contact_no= {p} ")
cur=db.cursor()
for i in cur:
n=i[0]
c=i[1]
a=i[2]
ad=i[3]
d=i[4]
p=i[5]
print(f"name= {n} ,\t class= {c} ,\t admission_no= {a} , \t address= {ad} ,\t date_of_birth= {d} ,\t
contact_no= {p} ")
else:
csd()
main()
print("\n")
cutr=db.cursor()
for i in cutr:
n=i[0]
post=i[1]
sub=i[2]
sal=i[3]
ad=i[4]
co=i[5]
ac=i[6]
print(f"name= {n} ,\t post= {post} ,\t subject= {sub} , \t salary= {sal} ,\t address= {ad} ,\t
contact_no= {co} ,\t account_no= {ac}")
main()
print("\n")
cur=db.cursor()
for i in cur:
n=i[0]
c=i[1]
a=i[2]
ad=i[3]
d=i[4]
p=i[5]
print(f"name= {n} ,\t class= {c} ,\t admission_no= {a} ,\t address= {ad} ,\t date_of_birth= {d} ,\t
contact_no= {p} ")
mycursor=db.cursor()
db.commit()
print("UPDATED TABLE")
cur=db.cursor()
for i in cur:
n=i[0]
c=i[1]
a=i[2]
ad=i[3]
d=i[4]
p=i[5]
print(f"name= {n} ,\t class= {c} ,\t admission_no= {a} ,\t address= {ad} ,\t date_of_birth= {d} ,\t
contact_no= {p} ")
main()
try:
cur=db.cursor()
for i in cur:
n=i[0]
c=i[1]
a=i[2]
ad=i[3]
d=i[4]
p=i[5]
print(f"name= {n} ,\t class= {c} ,\t admission_no= {a} , \t address= {ad} ,\t date_of_birth= {d} ,\t
contact_no= {p} ")
admi=input("Choice admission_no fron above table in which you want to update data - ")
print("\n NOTE fill all the column correctly for successful update ")
mycursor.execute(f"update s set
name='{n}',class={cl},address='{ad}',date_of_birth='{dob}',contact={co} where admission_no
={admi}")
db.commit()
crs=db.cursor()
for i in crs:
n=i[0]
c=i[1]
a=i[2]
ad=i[3]
d=i[4]
p=i[5]
print(f"name= {n} ,\t class= {c} ,\t admission_no= {a} , \t address= {ad} ,\t date_of_birth= {d} ,\t
contact_no= {p} ")
main()
except:
main()
try:
mc=db.cursor()
for r in s:
print(r)
db.commit()
cur=db.cursor()
for i in cur:
n=i[0]
c=i[1]
a=i[2]
ad=i[3]
d=i[4]
p=i[5]
print(f"name= {n} ,\t class= {c} ,\t admission_no = {a} ,\t address= {ad} ,\t date_of_birth= {d},\t
contact_no= {p} ")
main()
except:
main()
try:
cutr=db.cursor()
for i in cutr:
n=i[0]
post=i[1]
sub=i[2]
sal=i[3]
ad=i[4]
co=i[5]
ac=i[6]
print(f"name= {n} ,\t post= {post} ,\t subject= {sub} , \t salary= {sal} ,\t address= {ad} ,\t
contact_no= {co} ,\t account_no= {ac}")
db.commit()
cutr=db.cursor()
for i in cutr:
n=i[0]
post=i[1]
sub=i[2]
sal=i[3]
ad=i[4]
co=i[5]
ac=i[6]
print(f"name= {n} ,\t post= {post} ,\t subject= {sub} , \t salary= {sal} ,\t address= {ad} ,\t
contact_no= {co} ,\t account_no= {ac}")
main()
except:
print("\n DUE TO THE WRONG INPUT YOU ARE SEND TO MAIN FUNCTION")
main()
try:
cutr=db.cursor()
n=i[0]
post=i[1]
sub=i[2]
sal=i[3]
ad=i[4]
co=i[5]
ac=i[6]
print(f"name= {n} ,\t post= {post} ,\t subject= {sub} , \t salary= {sal} ,\t address= {ad} ,\t
contact_no= {co} ,\t account_no= {ac}")
print("Select from above data the ( name ,post, subject) of teacher which you want to remove")
cool=db.cursor()
cool.execute(f"delete from tea where name='{n}' and post='{post}' and subject='{sub}' ")
db.commit()
mcutr=db.cursor()
for i in mcutr:
n=i[0]
post=i[1]
sub=i[2]
sal=i[3]
ad=i[4]
co=i[5]
ac=i[6]
print(f"name= {n} ,\t post= {post} ,\t subject= {sub} , \t salary= {sal} ,\t address= {ad} ,\t
contact_no= {co} ,\t account_no= {ac}")
main()
except:
print("\n DUE TO THE WRONG INPUT YOU ARE SEND TO MAIN FUNCTION")
main()
try:
cutr=db.cursor()
for i in cutr:
n=i[0]
post=i[1]
sub=i[2]
sal=i[3]
ad=i[4]
co=i[5]
ac=i[6]
print(f"name= {n} ,\t post= {post} ,\t subject= {sub} , \t salary= {sal} ,\t address= {ad} ,\t
contact_no= {co} ,\t account_no= {ac}")
print("Select from above data the ( name ,post, subject) of teacher which you want to update")
print("\n NOTE fill all the column correctly for successful update ")
mycursor =db.cursor()
db.commit()
cros=db.cursor()
cros.execute(f"select * from tea where name='{na}' and post='{po}' and subject='{subj}' ")
for i in cros:
N=i[0]
ost=i[1]
Sub=i[2]
sal=i[3]
ad=i[4]
con=i[5]
ac=i[6]
print(f"name= {N} ,\t post= {ost} ,\t subject= {Sub} , \t salary= {sal} ,\t address= {ad} ,\t
contact_no= {con} ,\t account_no= {ac}")
main()
except:
main()
try:
cur=db.cursor()
for i in cur:
n=i[0]
cl=i[1]
ad=i[2]
last_fee=i[6]
amount=i[7]
note=i[8]
print(f"name= {n} ,\t class= {cl} ,\t admission_no= {ad} , \t last_fee= {last_fee} ,\t
amount_of_last_fee= {amount} ,\t note= {note} ")
mycursor =db.cursor()
db.commit()
crs=db.cursor()
for i in crs:
n=i[0]
c=i[1]
a=i[2]
last_fee=i[6]
amount=i[7]
note=i[8]
print(f"name= {n} ,\t class= {c} ,\t admission_no= {a} , \t last_fee= {last_fee} ,\t
amount_of_last_fee= {amount} ,\t note= {note} ")
main()
except:
print("\n YOU ENTER INCORRECT INPUT YOUR SEND TO MAIN FUNCTION ")
main()
try:
for i in cutr:
n=i[0]
post=i[1]
sub=i[2]
sal=i[3]
ac=i[6]
lastsal=i[7]
amo=i[8]
nt=i[9]
print(f"name= {n} ,\t post= {post} ,\t subject= {sub} , \t salary= {sal} ,\t account_no= {ac} ,\t
last_salary_date={lastsal},\t last_salary_amount={amo},\t note={nt}")
print("Select from above data the ( name ,post, subject) of teacher in which you want to update
salary ")
mycursor =db.cursor()
cros=db.cursor()
cros.execute(f"select * from tea where name='{n}' and post='{post}' and subject='{sub}' ")
for i in cros:
n=i[0]
post=i[1]
sub=i[2]
sal=i[3]
ac=i[6]
lastsal=i[7]
amo=i[8]
nt=i[9]
print(f"name= {n} ,\t post= {post} ,\t subject= {sub} , \t salary= {sal} ,\t account_no= {ac} ,\t
last_salary_date={lastsal},\t last_salary_amount={amo},\t note={nt}")
main()
except:
main()
print('''
print('''
\t \t \t \t 3.ADD STUDENT
\t \t \t \t 4.ADD TEACHER
\t \t \t \t 5.REMOVE STUDENT
\t \t \t \t 6.REMOVE TEACHER
\t \t \t \t 9.SUBMIT FEES
\t \t \t \t 10.PAY SALARY
\t \t \t \t 11.EXIT
''')
if (choice=="1"):
csd()
elif(choice=="2"):
ctd()
elif(choice=="3"):
ads()
elif(choice=="4"):
adtea()
elif(choice=="5"):
rs()
elif(choice=="6"):
rtea()
elif(choice=="7"):
ups()
elif(choice=="8"):
uptea()
elif(choice=="9"):
fee()
elif(choice=="10"):
sal()
elif(choice=="11"):
exit()
else:
print("!!!!!!!!!!! \t\t WRONG INPUT ENTERED PLEASE CHOICE CORRECT NUMBER FROM(1-9) \t\
t !!!!!!!!!!!!!!!!!")
main()
x=True
cot=0
while x: #This piece of program asked password for login # THIS FOR SAFETY
if check=="0000":
main()
x=False
else:
cot+=1
if cot==3:
x=False
else: