<jupyter_start><jupyter_text>establishing a connection to the SQLite database by creating a Connection object.con = mycon.connect(host="localhost2",user="root",password="<PASSWORD>",database="school")<jupyter_code>#Defioning add student function

def add_student():
    n = input("Student Name:")
    class_studying = input("class name:")
    roll = input("Roll No:")
    address = input("Address:")
    phone = input("Phone no:")
    
    data = (n,class_studying,roll,address,phone)
    
    
#Next, creating a Cursor object using the cursor method of the Connection object. Then, execute a SELECT statement. 
#After that, call the fetchall() method of the cursor object to fetch the data.
    
    sql = 'INSERT INTO student VALUES(%s,%s,%s,%s,%s)'         #sql query
    c = con.cursor()
    c.execute(sql,data)                             #executing sql query and data in c
    con.commit()
    print("Data Entered Successfully")
    print("--------------------------------------------------------------------------------------------------")

    main()

#Defining remove_student function

def remove_student():
    class_studying = input("class name:")
    roll = input("Roll No:")
    
    data = (class_studying,roll)
    
    sql = 'DELETE FROM student WHERE class_studying=%s and roll=%s'
    c = con.cursor()
    c.execute(sql,data)
    con.commit()
    print("Data Updated")
    print("--------------------------------------------------------------------------------------------------")

    main()
#Defining add teacher function

def add_teacher():
    n = input("Teacher Name:")
    post = input("Teacher Post:")
    salary = input("Teacher's salary:")
    address = input("Address:")
    phone = input("Phone no:")
    acc = input("Teacher's Account")
    
    data = (n,post,salary,address,phone,acc)
    
    sql = 'INSERT INTO teacher VALUES(%s,%s,%s,%s,%s,%s)'            #sql query
    c = con.cursor()
    c.execute(sql,data)                             #executing sql query and data in c
    con.commit()
    print("Data Entered Successfully")
    print("--------------------------------------------------------------------------------------------------")

    main()
#Defining remove_teacher function

def remove_teacher():
    n = input("Teacher Name:")
    acc = input("Teacher's Account")
    
    data = (n,account)
    
    sql = 'DELETE FROM teacher WHERE n=%s and acc=%s'
    c = con.cursor()
    c.execute(sql,data)
    con.commit()
    print("Data Updated")
    print("--------------------------------------------------------------------------------------------------")

    main()
#defining absent in class

def absent_class():
    d = input("Date:")
    class_studying = input("class name:")
    names_absent_student = input("Names of absent students:")
    
    data = (d,class_studying,names_absent_student)
    
    
    sql = 'INSERT INTO cattendance VALUES(%s,%s,%s)'            #sql query
    c = con.cursor()
    c.execute(sql,data)                             #executing sql query and data in c
    con.commit()
    print("Data Updated")
    print("--------------------------------------------------------------------------------------------------")

    main()

#defining absent teachers

def absent_teachers():
    d = input("Date:")
    names_absent_teacher = input("Names of absent teachers:")
    
    data = (d,names_absent_teacher)
    
    
#Next, creating a Cursor object using the cursor method of the Connection object. Then, execute a SELECT statement. 
#After that, call the fetchall() method of the cursor object to fetch the data.
    
    sql = 'INSERT INTO tattendance VALUES(%s,%s)'            #sql query
    c = con.cursor()
    c.execute(sql,data)                             #executing sql query and data in c
    con.commit()
    print("Data Entered Successfully")
    print("--------------------------------------------------------------------------------------------------")

    main()
#defining submmit fees

def submit_fees():
    n = input("Student Name:")
    class_studying = input("class name:")
    roll = input("Roll No:")
    m = input("Month:")
    y = input("Year:")
    fees = input("Fees amount:")
    d = input("Date:")
    
    data = (n,class_studying,roll,m,y,fees,d)
    
    sql = 'INSERT INTO fees VALUES(%s,%s,%s,%s,%s,%s,%s)'
    c = con.cursor()
    c.execute(sql,data)
    con.commit()
    print("Data Entered successfully")
    print("------------------------------------------------------------------------------------------------------")
    
    main()
#defining pay_Salary function

def pay_salary():
    n = input("Teacher Name:")
    m = input("Month: ")
    y = input("Year:")
    stat = input("Payment status : YES/NO")
    
    data = (n,m,y,stat)
    
    sql = 'INSERT INTO salary VALUES(%s,%s,%s,%s)'
    c = con.cursor()
    c.execute(sql,data)
    con.commit()
    print("Data Entered successfully")
    print("------------------------------------------------------------------------------------------------------")
    
    main()
#display class students info

def display_class():
    class_studying = input("Class:")
    data = (class_studying,)
    sql = "SELECT * FROM student WHERE class_studying=%s"
    
    c = con.cursor()
    c.execute(sql,data)
    details = c.fetchall()              #all 5 input values will be fetched
    
    for i in details:
        print("Name:",i[0])
        print("Class:",i[1])
        print("Roll No:",i[2])
        print("Address:",i[3])
        print("Phone:",i[4])
        
    print("-----------------------------------------------------------------------------------------------------------")
                
    main()
#display a teacher's info

def display_teacher():
    n = input("enter the name of teacher you want to fetch info for:")
    data = (name,)
    
    sql = 'SELECT * FROM teacher WHERE n=%s'
    c = con.cursor()
    c.execute(sql)
    details = c.fetchall()
    
    for i in details:
        print("Teacher Name:",i[0])
        print("Post:",i[1])
        print("Salary:",i[2])
        print("Address:",i[3])
        print("Phone:",i[4])
        print("Account number:",i[5])

        print("-------------------------------------------------------------------------------------------------------------")
        
    main()

#Displayiong all teachers information

#display a teacher's info

def display_teachers():
    
    sql = 'SELECT * FROM teacher'
    c = con.cursor()
    c.execute(sql)
    details = c.fetchall()
    
    for i in details:
        print("Teacher Name:",i[0])
        print("Post:",i[1])
        print("Salary:",i[2])
        print("Address:",i[3])
        print("Phone:",i[4])
        print("Account number:",i[5])

        print("-------------------------------------------------------------------------------------------------------------")
        
    main()
#defining main()

def main():
    
    print("""                           GIRRAJ INTERNATIONAL SCHOOL

                            1.  ADD STUDENT                 2.  REMOVE STUDENT

                            3.  ADD TEACHER                 4.  REMOVE TEACHER

                            5. CLASS ATTENDANCE             6.  TEACHER ATTENDANCE

                            7. SUBMIT FEES                  8.  PAY SALARY

                            9. DISPLAY CLASS               10. A TEACHERS Info
                              
                            11. All teachers Info 
                            """)
          

    choice = input("Enter the task you want to execute")

    print("------------------------------------------------------------------------------------------------------------")

    if (choice == "1"):

        add_student()

    elif (choice=="2"):

        remove_student()

    elif (choice=="3"):

       add_teacher()

    elif (choice=="4"):

        remove_teacher()

    elif (choice=="5"):

        absent_class()

    elif (choice == "6"):

        absent_teachers()

    elif (choice=="7"):

        submit_fees()

    elif (choice == "8"):

        pay_salary()

    elif (choice == "9"):

        display_class()

    elif (choice == "10"):

        display_teacher()
          
    elif (choice == "11"):

        display_teachers()

    else:

        print("Please select the correct option")
        main()
          

def pswd():

    p = input("Password :")

    if p == "sms":

        main()

    else:

        print("Wrong Password")

        pswd()

pswd()                    #will call password function first while execution<jupyter_output>Password :sms
                           GIRRAJ INTERNATIONAL SCHOOL

                            1.  ADD STUDENT                 2.  REMOVE STUDENT

                            3.  ADD TEACHER                 4.  REMOVE TEACHER

                            5. CLASS ATTENDANCE             6.  TEACHER ATTENDANCE

                            7. SUBMIT FEES                  8.  PAY SALARY

                            9. DISPLAY CLASS               10. A TEACHERS Info
                              
                            11. All teachers Info 
                            
Enter the task you want to execute1
------------------------------------------------------------------------------------------------------------
Student Name:shelvi
class name:5 c
Roll No:789
Address:gn
Phone no:8000
Data Entered Successfully
--------------------------------------------------------------------------------------------------
                           GIRRAJ INTERNATIONAL SCHOOL

                      [...]
{'fraction_non_alphanumeric': 0.25585529067335844, 'fraction_numerical': 0.007005437055625261, 'mean_word_length': 1.2322053675612603, 'pattern_counts': {'":': 1, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '67564', 'license': 'MIT', 'n_tokens_mistral': 2566, 'n_tokens_neox': 2423, 'n_words': 673, 'path': 'school-management-system.py.ipynb', 'repo_name': 'shelvi31/School-Management-System', 'size': '9562'}