TAAFT
Free mode
100% free
Freemium
Free Trial
Prompts Deals

Kido Arts's tools

  • Computer Science project class 12th
    Generate complete Python projects for 12th grade exams.
    Open
    # Class 12th CS Practical Examination Project ## Undertaking I, [Your Name], a student of Class 12th, hereby declare that the project titled "Data Handling and SQL Connectivity" is my original work and has not been copied from any other source. I have taken proper care to ensure that the project is free from any plagiarism. Date: [Insert Date] Signature: [Your Signature] ## Certificate This is to certify that the project titled "Data Handling and SQL Connectivity" has been completed by [Raghav], [Vishesh], and [Aatishey] under my supervision. The project is their original work and has been executed as per the guidelines provided by the CBSE. Supervisor's Name: [Your Supervisor's Name] Date: [Insert Date] Signature: [Supervisor's Signature] ## Acknowledgement We would like to express our sincere gratitude to our Computer Science teacher, [Teacher's Name], for their guidance and support throughout the completion of this project. We also thank our school for providing us with the necessary resources and environment to carry out this project successfully. ## Content 1. Introduction to the Program 2. System Requirements for the Program 3. Python Coding 4. Outputs ## Introduction to the Program This project aims to demonstrate the use of Python for data handling and SQL connectivity. The program will allow users to perform basic CRUD (Create, Read, Update, Delete) operations on a SQLite database. The program will also include functions for data manipulation and display. ## System Requirements for the Program - Python 3.x - SQLite3 - Any Python IDE (e.g., PyCharm, VS Code) - Basic knowledge of Python and SQL ## Python Coding ```python import sqlite3 # Connect to SQLite database (or create it if it doesn't exist) conn = sqlite3.connect('students.db') cursor = conn.cursor() # Create a table cursor.execute(''' CREATE TABLE IF NOT EXISTS students ( id INTEGER PRIMARY KEY, name TEXT NOT NULL, age INTEGER NOT NULL, grade TEXT NOT NULL ) ''') # Function to add a new student def add_student(name, age, grade): cursor.execute(''' INSERT INTO students (name, age, grade) VALUES (?, ?, ?) ''', (name, age, grade)) conn.commit() print(f"Student {name} added successfully.") # Function to view all students def view_students(): cursor.execute('SELECT * FROM students') rows = cursor.fetchall() for row in rows: print(f"ID: {row[0]}, Name: {row[1]}, Age: {row[2]}, Grade: {row[3]}") # Function to update a student's grade def update_grade(student_id, new_grade): cursor.execute(''' UPDATE students SET grade = ? WHERE id = ? ''', (new_grade, student_id)) conn.commit() print(f"Grade updated for student ID {student_id}.") # Function to delete a student def delete_student(student_id): cursor.execute(''' DELETE FROM students WHERE id = ? ''', (student_id,)) conn.commit() print(f"Student with ID {student_id} deleted.") # Example usage add_student("Raghav", 17, "12th") add_student("Vishesh", 18, "12th") add_student("Aatishey", 17, "12th") print("\nAll Students:") view_students() update_grade(1, "12th A") print("\nAfter updating grade:") view_students() delete_student(2) print("\nAfter deleting a student:") view_students() # Close the connection conn.close() ``` ## Outputs ### Initial Output ``` Student Raghav added successfully. Student Vishesh added successfully. Student Aatishey added successfully. All Students: ID: 1, Name: Raghav, Age: 17, Grade: 12th ID: 2, Name: Vishesh, Age: 18, Grade: 12th ID: 3, Name: Aatishey, Age: 17, Grade: 12th ``` ### After Updating Grade ``` Grade updated for student ID 1. After updating grade: ID: 1, Name: Raghav, Age: 17, Grade: 12th A ID: 2, Name: Vishesh, Age: 18, Grade: 12th ID: 3, Name: Aatishey, Age: 17, Grade: 12th ``` ### After Deleting a Student ``` Student with ID 2 deleted. After deleting a student: ID: 1, Name: Raghav, Age: 17, Grade: 12th A ID: 3, Name: Aatishey, Age: 17, Grade: 12th ```
0 AIs selected
Clear selection
#
Name
Task