The document contains a Python script for a school management system that allows adding and removing students and teachers, as well as displaying them. It includes functions for database operations using MySQL and a simple text-based menu for user interaction. There are several syntax errors and typos throughout the code that need to be corrected for proper functionality.
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 ratings0% found this document useful (0 votes)
4 views3 pages
source code
The document contains a Python script for a school management system that allows adding and removing students and teachers, as well as displaying them. It includes functions for database operations using MySQL and a simple text-based menu for user interaction. There are several syntax errors and typos throughout the code that need to be corrected for proper functionality.
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/ 3
SOURCE CODE
import mysql.connector from getpass import getpass
# Database connection db mysql.connector.connect host"lacalhost",
Usereoo' database'cbse
cursor = db.cursor)
#Function to add a new student
def add_student(): first name =input("Enter student's first name:") last_name input("'Enter student's last name:") roll_number int(input("Enter student's roll number:")) cursor.execute("INSERT INTO students (first_name, last_narne, roll_number) VALUES (%s, %s, %5)", (first_name, last_name, rol_number)) db.commit() print("Student added successfulyl") WFunction to remove a student def temove student): roll_number int(input("Enter the roll number of the student to remove:")) cursor.execute("DELETE FROM students WHERE roll number s", (roll_number,)) db.commit() print("Student removed successfully!") # Function to add a new teacher def add _teacher): ut("Enter teacher's first name:
teacher_id =int(input[' Enter the iD of the teacher to remove:"))
cursor.execute("DELETE FROM teschers WHERE Id - 9%s", (teacher_id.) db,commit() print("Teacher removed successfully!") -WELCOME TO THE SCHOOL MANAGEMENT SYrSTEM MADE BY ØaAgHSNEH KAUR