Skip to content

Smoki-Cool/class-12-practical-programs

Repository files navigation

Final Practical Python Programs and SQL Queries

This repository contains Python programs developed for my final practical file in CBSE Class 12th. These programs showcase my understanding and application of various concepts covered during the course.

Usage

No extra installations are needed to run the python programs. However, mysql-connector-python module is required to run the python-sql connectivity programs.

Python Programs

  • This program calculates the factorial of a user-input number using functions.
  • This program checks if a user-input number is prime or not.
  • Calculates the nth term of the Fibonacci series.
  • Generates random numbers between 1 and 6.
  • Demonstrates variable-length arguments to calculate the product and power of the first 10 numbers.
  • Accepts the number of days, converts it to weeks, and handles errors including the finally clause.
  • Searches for a user-provided word in a given string or sentence.
  • Reads and displays file content line by line with words separated by '*'.
  • Reads file content and displays the total number of uppercase and lowercase characters.
  • Creates a binary file to store Employee Name and Employee Code, allowing the user to display employee names based on the entered code.
  • Creates a binary file to store RollNo, Name, and marks of students, allowing the user to update marks based on the entered RollNo.
  • Reads file content line by line and writes it to another file, excluding lines containing the letter 'o'.
  • Creates a binary file with emp id, name, and salary, provides a function to update the salary based on employee id.
  • Prints cursor position and text according to specific specifications.
  • Implements a stack in Python using a list.

1. Movie Database

  • Creates a database MOVIE_DATABASE with a table MOVIE and performs various operations on it.

2. Movie Queries

  • Performs queries on the MOVIE table to retrieve information about movies.

3. Movie Yearly Statistics

  • Retrieves yearly statistics from the MOVIE table.

4. Movie Updates

  • Updates records in the MOVIE table.

5. Review Queries

  • Performs queries on the Review table based on movie ratings and collection.

Python-SQL Connectivity Programs

  • Creates a database named "Store" and displays the list of databases available in MySQL.
  • Creates a table named "Products" under the "Store" database with columns for Product name, category, price, and discount.
  • Description: Inserts records into the "Products" table and displays all records.
  • Increases the price of products whose names contain the alphabet 'a' and displays the number of updated records.

Running the Programs

To run a specific program, navigate to its directory and execute the following command:

python program_name.py

Replace program_name.py with the name of the Python file you want to run.

Running the SQL Queries

  1. MySQL Command-Line:

    • Open a terminal or command prompt.

    • Connect to your MySQL server using the following command, replacing [username] with your MySQL username and [password] with your password:

      mysql -u [username] -p
    • Enter your password when prompted.

  2. Execute SQL Script:

    • Run the SQL script using the following command, replacing [path/to/sql/script.sql] with the path to your SQL script:

      source /path/to/sql/script.sql

Warning

The Review table creation queries needed to run the last sets of queries is not provided in the script.

License

This repository is licensed under the MIT License.

Author

Jairaj K. Bhuyan (GitHub: Smoki-Cool)

About

Computer Science final practical file.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages