Acknowledgement
I would like to express my sincere gratitude to my Computer
Science teacher “Mr. Atul Saxena” for the valuable guidance and
support provided during the preparation of this practical file on
Python Functions and File Handling. This project helped me
understand important programming concepts such as functions,
loops, file operations, dictionaries, and menu-driven programs in a
practical and interesting way.
I am also thankful to my school for providing the necessary
facilities and learning environment to complete this work
successfully. Special thanks to my parents and friends for their
encouragement and support throughout the preparation of this file.
This practical file has improved my logical thinking and
programming skills. I have learned how Python functions make
programs reusable and how file handling helps in storing and
managing data efficiently.
I hope this project fulfills all the required objectives and reflects my
sincere efforts and learning.
Certificate
This is to certify that this practical file titled “Python Functions
and File Handling” has been successfully completed by “Utkarsh”,
a student of “Class-XII-A(Science)” as part of the Computer Science
practical work for the academic session.
The file contains well-structured Python programs based on
functions and file handling concepts. The student has completed
the work sincerely under proper guidance and has demonstrated a
good understanding of Python programming fundamentals.
The practical file includes programs with proper objectives,
explanations, outputs, and file handling operations which fulfill
the requirements prescribed for the subject.
Teacher’s Signature: ____________________
Student’s Signature: ____________________
Date: ____________________
Index
1. Function to Calculate Factorial ....................................... Page 1
2. Function to Find Prime Numbers in a Range .............. Page 2
3. Function to Count Words in a Text File ......................... Page 3
4. Function to Copy One File into Another ........................ Page 4
5. Function to Append Student Records ............................ Page 5
6. Function to Search a Word in a File .............................. Page 6
7. Function to Calculate Average Marks from File ........... Page 7
8. Function to Store and Read Dictionary Data ................ Page 8
9. Function to Count Lines, Words and Characters .......... Page 9
10. Menu Driven File Handling Program ........................ Page 10
Conclusion
Through this practical file, I learned the importance of Python
functions and file handling in computer programming. Functions
help in organizing programs into smaller reusable parts, making
the code easier to understand and maintain. File handling allows
programs to store, read, and manage data permanently using text
files.
The programs included in this file improved my understanding of
concepts such as loops, conditions, lists, dictionaries, file modes,
and string operations. I also learned how Python can be used to
create real-life applications like student record systems, to-do lists,
file analysis tools, and data storage programs.
Overall, this project enhanced my programming skills, logical
thinking, and confidence in writing Python programs. It was an
informative and practical learning experience that strengthened
my understanding of computer science concepts.