Aditya Kumar - Student Grading System
Aditya Kumar - Student Grading System
Aditya Kumar
12 – F
Roll no: 3
connection=database.connect(host="localhost", user='root',
passwd='1234', database='test')
cursor=connection.cursor()
def update_record():
roll=input("Which student's details do you want to
update?\nRoll No: ")
choice=int(input("[UPDATING DETAILS]\n\n1. Roll No\n2.
Name\n3. Class\nEnter Choice : "))
print()
if choice==1:
new_roll=int(input("Enter the new roll no: "))
update=f"update students set RollNo={new_roll} where
RollNo={roll}"
cursor.execute(update)
cursor.execute(update)
elif choice==3:
new_class=int(input("Enter the new class: "))
update=f"update students set Class={new_class} where
RollNo={roll}"
cursor.execute(update)
def insert_record():
roll = int(input("Enter Roll No : "))
name = input("Enter Name : ")
class_int = int(input("Enter Class : "))
insert=f'insert into students
values({roll},"{name}",{class_int},"-","")'
print(insert)
cursor.execute(insert)
cursor.execute(f'select * from students where Name =
"{name}"')
print()
for i in cursor:
print(i);
print()
def delete_record():
roll=int(input("[DELETING]\n\nWhich entry would you like
to delete?\n Roll No: "))
delete=f"delete from students where RollNo={roll}"
cursor.execute(delete)
cursor.execute("select * from students");
print()
for i in cursor:
print(i)
print()
def grade():
totalMarks =
mathsMarks+physicsMarks+chemMarks+compMarks+english
Marks
percent = round((totalMarks/500)*100,2)
elif choice == 4:
grade()
elif choice == 7:
connection.commit()
OUTPUT: