0% found this document useful (0 votes)
14 views32 pages

Python & SQL Practical File for XII

The document is a practical file for a Computer Science course focusing on Python programming and SQL for the academic year 2025-26. It includes a certification of completion by the teacher and a list of programming tasks that cover various concepts such as file handling, database connectivity, and data manipulation. The tasks require the implementation of functions and programs to perform operations like checking prime numbers, counting vowels, and managing records in MySQL.

Uploaded by

sonarsoumya
Copyright
© All Rights Reserved
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% found this document useful (0 votes)
14 views32 pages

Python & SQL Practical File for XII

The document is a practical file for a Computer Science course focusing on Python programming and SQL for the academic year 2025-26. It includes a certification of completion by the teacher and a list of programming tasks that cover various concepts such as file handling, database connectivity, and data manipulation. The tasks require the implementation of functions and programs to perform operations like checking prime numbers, counting vowels, and managing records in MySQL.

Uploaded by

sonarsoumya
Copyright
© All Rights Reserved
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

PRACTICAL File

COMPUTER
SCIENCE (083)
SESSION 2025-26

Topic:- Python Programming and SQL

SUBMITTED BY:- SUBMITTED TO:


MEET SUBHASH KOLI HEMA MALIK
12TH A (PGT CS)
15138353
Certificate

This is to certify that Meet Subhash Koli, student of


class XII, KVM School has completed the Practical File
during the academic year 2025-2026 based on the
syllabus. He has completed the practical work
independently and has shown atmost sincerity in
completion of this file. This practical file fully
implements all the topics and concepts learnt in Python
and MySql covered as per the C.B.S.E. syllabus of
computer science. I certify that this practical file is up to
my expectations and as per the guidelines issued by
C.B.S.E.

Teachers Principal Examiner


Signature Signature Signature
1. Write a program in python to check a number whether it is Prime or not
using user defined function.
2. Write a program to input a character and to print whether a given
character is an alphabet, digit or any other character.
3. Write a python function sin(x,n) to calculate the value of sin(x) using its Taylor
series expansion up to n terms.
4. Write a program to generate random numbers between 1 to 6 and check
whether a user won a lottery or not.
5. Write a program to count the number of vowels present in a text file.
6. Write a program to write those lines which have the character 'p' from one text
file to another text file.
7. Write a program to count number of words in a Text file.
8. Write a program to insert n records in a binary file [Link].
[Link] a program to read records from binary file [Link].
10. Write a program to implement search operation in a binary file.
11. Write a program to update a record stored in binary file [Link].
12. Write a program to delete a record from binary file.
13. Write a program to create a CSV file and read it.
14. Write a program to count number of records from CSV file.
15. Write a program to save some user id and passwords in a csv file. Ask
user to enter a user id and password, if combination matches it should
print ‘welcome’ other wise print ‘data mismatch’.
16. Write a program to insert an element in the list.
17. Write a menu based program to perform PUSH, POP and
DISPLAY operation on stack in python using list.
18. Write a menu based program to perform PUSH, POP
and DISPLAY operation on stack in python using
Dictionary.
19. Write a program to connect Python with MySQL using database
connectivity and perform the following operations on data in
database:company(Table:employee) Add, Search, Update, Delete and View
complete Table.
20. Write a program to connect Python with MySQL using database
connectivity and perform the following operations on data in
database:Class_management(Table:Class_info) Fetch, Update and
delete the data.
21. Create the following table PRODUCT in
MySql and answer the questions follows:

[Link] increase the Price of all Products by 10.


[Link] display average price ofproduct sorted on the basis of Manufacturer.

[Link] display minimum and maximum Price of product Manufacturer


wise

[Link] display details of product having name ends with ‘h’.

[Link] display product name and price of product having P_ID either BS01 or
FW12.
[Link] display manufacturer wise sum of Price in descending order of Price.

[Link] count and print unique Manufacturer.

[Link] print average Price of product from manufacturer either ‘ABC’


or ‘XYZ’.

[Link] delete record of ‘Shampoo’.


[Link] decrease the price of product by 20 of manufacturer ‘XYZ’

[Link] print P_ID, ProductName, price and price of 12 items as


BunchPrice.

[Link] print details of product with null manufacturer.


22. Consider following tables and answer queries (i) to (iv)

Common questions

Powered by AI

Database connectivity in Python, specifically through libraries like MySQL Connector, significantly enhances Python's capabilities in data management by enabling robust interaction with SQL databases. By performing CRUD (Create, Read, Update, Delete) operations on SQL tables, Python scripts can dynamically interact with large datasets, automate data processing tasks, and ensure data integrity through validation checks. This connectivity is pivotal for applications requiring persistent data, such as web development and data analysis, providing a scalable and reliable mechanism for managing complex data relationships and transactions .

Using MySQL functions for data analysis, such as calculating the average price of products, aids students in understanding the fundamental processes involved in data aggregation and summary statistics. These functions enable the execution of complex calculations directly within the database, demonstrating the efficiency and power of SQL in handling voluminous data. Understanding how to apply and interpret these functions helps students in performing analytical tasks, deriving insights from data, and making informed decisions based on statistical outputs, thereby bridging the gap between database management and data science .

Implementing search and update operations in data files is a fundamental aspect of programming education because it teaches students how to efficiently locate, modify, and manage data within file systems. This skill is vital for developing robust applications capable of dynamic data manipulation and user interaction, such as databases and content management systems. Understanding the algorithms behind search and update operations fosters a deeper comprehension of data structures, file management systems, and performance optimization, all essential for crafting efficient and scalable software solutions .

Programming exercises involving file operations in Python serve to teach students practical implementations of data storage, retrieval, and manipulation, which are crucial skills in any data-driven discipline. These exercises promote understanding of input/output operations, the handling of different file types, and the concept of data persistence. Such tasks also foster problem-solving skills as students learn to read from, write to, and process data efficiently while dealing with various real-world scenarios, enhancing their ability to manage and analyze data programmatically .

User-defined functions in Python allow encapsulation of logic, making code reusable and more organized. For checking whether a number is prime, using a user-defined function enables one to isolate the prime-checking logic within a single function, which can be reused across different parts of the program or in different programs. This practice enhances code readability and maintainability, as developers can understand the function's purpose and modify logic in one place if needed. This isolation also aids in testing and debugging .

The Taylor series is a mathematical representation of functions as infinite sums of terms calculated from the values of their derivatives at a single point. In Python, calculating sine using its Taylor series expansion allows for an approximation of the sine value through a finite number of terms, which is particularly useful when high precision is not required, or when built-in functions are restricted. This approach is computationally significant as it helps understand and implement trigonometric calculations algorithmically, giving students insight into both approximations in mathematics and efficient algorithm implementations .

Exercises involving SQL queries on datasets, such as updating product prices, provide hands-on experience with database management, reinforcing theoretical knowledge of SQL syntax and operations. These tasks enhance students' understanding of the relational database model and its practical applications in data manipulation. Additionally, such exercises stimulate analytical thinking as students must determine the logic to achieve specific results, promoting proficiency in forming complex queries and understanding data relationships, which are essential skills in database administration and data analysis .

Learning to manipulate binary files in Python is crucial as it exposes students to handling non-textual data, which is not human-readable and often requires precision in data parsing. This skill is vital in fields where data is stored in binary format for efficiency and compactness, such as images, executables, and multimedia. The exercises develop meticulous attention to data integrity, an understanding of data encoding/decoding processes, and the ability to work with low-level data operations, enhancing problem-solving skills and preparing students for real-world scenarios involving complex data formats .

CSV file manipulation exercises in Python train students in handling one of the most common data formats used in data exchange and storage. These exercises expose students to real-world data processing tasks, such as data cleaning, transformation, and analysis, which are critical in environments like data science and analytics. Engaging with CSV files enhances students' skills in extracting meaningful information from raw datasets, applying filters and transformations, and effectively utilizing Python libraries for efficient data management, preparing them for tasks encountered in professional data workflows .

Implementing stack operations such as PUSH, POP, and DISPLAY using Python lists showcases foundational computer science concepts like data abstraction, the Last In, First Out (LIFO) principle, and memory management. Lists in Python offer built-in methods that make implementing stack operations straightforward, allowing students to focus on understanding the logic and behavior of stacks rather than the intricacies of low-level data manipulation. This approach exemplifies modular design and encapsulation, crucial concepts in software development, while emphasizing the efficiency and functionality of dynamic data structures .

You might also like