Partial preview of the text
Download computer project cbse class 12 and more Slides Computer science in PDF only on Docsity!
Wy” VELAMMAL VIDYALAYA MEL AYANAMBAKKAM COMPUTER SCIENCE PROJECT ACADEMIC YEAR: 2025 — 2026 TOPIC: PREPARED BY REGD.NO. NAME CLASS & SEC DATE OF SUBMISSION: GROUP MEMEBERS ACKNOWLEDGEMENT In the accomplishment of this project successfully, many people have bestowed their blessings and heart pledged support up on me, | take this opportunity to express my gratitude to all, who have been instrumental in the successful completion of this project. Primarily, | express my deep sense of gratitude to the luminary, The Principal, Dean and Sr.HM for providing the best of facilities and environment to bring out innovation and spirit of inquiry through this venture. | am deeply indebted to my _ teacher Elamathi.E, without whose constructive feedback, this project would not have been successful. The valuable advice and suggestions for correction, modifications and improvement did enhance the quality of the task. | would also like to thank my parents, friends and all the members who contributed to this project was vital for the success of the project. | am grateful for their constant support and help. CONTENTS: e INTRODUCTION e CSV FILE HANDLING e SOURCE CODE e OUTPUT e CONCLUSION e BIBLIOGRAPHY INTRODUCTION In the modern era of technology and data-driven decision-making, the ability to efficiently store, manage, and process data has become one of the most essential aspects of computer science. Among the various formats available for data storage, the CSV (Comma-Separated Values) format stands out as one of the simplest, most widely used, and highly compatible options. CSV files store data in plain text form, where each line represents a record and each field within a record is separated by a comma (or other delimiters such as semicolons or tabs). This simplicity allows CSV files to be easily created, shared, and read by a wide range of applications, including spreadsheets, databases, and programming languages. The main focus of this project is to explore and implement the concept of CSV file handling, which involves performing various operations such as reading, writing, appending, updating, and analyzing data stored in CSV files. File handling in computer science is a fundamental concept that allows programmers to interact with files stored on a computer system, enabling them to retrieve and manipulate information as needed. Through CSV file handling, we can automate the management of large datasets, streamline workflows, and build efficient systems for data processing and analysis. This project aims to provide a deeper understanding of how CSV files can be used for structured data storage and retrieval. By implementing different file operations programmatically, we gain practical experience in handling real-world datasets. For instance, CSV file handling can be applied to manage student records, financial transactions, product inventories, survey results, and many other forms of structured data. The simplicity of the CSV format, combined with the flexibility of programming languages such as Python, C++, or Java, makes it an ideal choice for both beginners and professionals. Furthermore, this project emphasizes not only the technical aspect of file manipulation but also the importance of data integrity, error handling, and efficiency in file operations. Understanding how to properly open, read, and close files helps prevent data corruption and resource wastage. Additionally, learning to handle exceptions and validate input data ensures that the system remains robust and reliable. In conclusion, the CSV File Handling Project serves as a foundational exercise in understanding how data can be stored, accessed, and processed using programming . It highlights the importance of structured data management in modern computing and demonstrates practical ways to automate everyday data-handling tasks. By completing this project, students not only gain technical knowledge about file I/O operations but also develop problem-solving and analytical thinking skills that are essential for real-world software development and data science applications. =csv.writer() it is used for writing in the csv file , for single row : . writerow() for multiple rows: syntax : syntax: . . . . . writerows() reader object can be assigned by: syntax: =csv.reader() it is used for reading the csv file, the reader object is a python usable sequence which can be accessed individually by loops. various modes in file handling r- reading only. Sets file pointer at beginning of the file. This is the default mode. rb — same as r mode but with binary file. r+ - both reading and writing. The file pointer placed at the beginning of the file. rb+ - same as r+ mode but with binary file. w - writing only. Overwrites the file if the file exists. If not,creates a new file for writing. wb — same as w mode but with binary file. wt - both writing and reading. Overwrites. If no file exists, creates a new file for reading & writing. wb+ - same as w+ mode but with binary file. a -for appending. Move file pointer at end of the file. Creates new file for writing,1f not exist. ab — same as a but with binary file Opening and Closing Files : To perform file operation, it must be opened first then after reading, writing, editing operation can be performed. To create any new file then too it must be opened. On opening of any file, a file relevant structure is created in memory as well as memory space is created to store contents. Once we are done working with the file, we should close the file. Closing a file releases valuable system resource. In case we forgot to close the file, Python automatically close the file when program ends or file object is no longer referenced in the program. However, if our program is large and we are reading or writing multiple files that can take significant amount of resource on the system. If we keep opening new files carelessly, we could run out of resources. So be a good computer science project libary mangement import csv from datetime import date t=date.toda () opw=" rough] .csv' oqw= ‘rough2. csv’ osw='rough3.csv' orw=str(t)+'namelist.csv' ouw=str(t)+'rented.csv' otw=str(t)+'bookrecord.csv' def need(): iu=[opw,oqw,osw] for 1 in tu: o=open(i,'w') o.flush() rint(“compeleted”’) def value( tqw=[] frw=open(opw,'a+' newline=") frw.seek(0 v=csv.reader(frw) for iop in v: tqwt=[iop] frw.flush() return tqw def addbook( ):#works Sha ‘serial no should be unique’) na while ch == "Y": s = int(in put "enter the serial no")) n= input("enter the name of the book") t= input("enter the name of author") = al no.of total books present")) =a n,t, a m=check( ; inputfn(k) ; ch=input("Y to keep adding elements") def check(k): xi=value() for i in x1: if int(i[0]) =k: print("invalid") return False pe i of books needed")) else: return True def checkiO(k): xi=value() for 1 in xt: if int(i[0]) =k: return True else: return False def inputfin(k): f=open(opw,"a+" newline=") l=csv.write I. writerow(k f-flushi def viewbook( ):#works re=value() for 1 in re: print(i) def rentbook( ):#works to = int(input("enter the serial no")) tq=value() for ir in tq: if int(ir[0]) = to: print(ir) X=ir z=int(x[4])-nty ifz<0: print("requried no of books not available try again ,use",x[4],"Wwhich is the maximum amt of books available") m=checkiO(y) oH n=value() i=int(input("enter the no of books to be deleted")) ifm: n{t-1][3] =int(n[t-1][3])-1 atone print("compeleted" n[t-1 def addingname(x,nty):#works c=int(in nut(“enter roll no")) u=input("enter your name ") ; tri=int(input("enter your grade ---in numbers---")) Xl =x[3 eq=[c,u a b,g.ni p=open(oqw, at" - me="") o=csv.writer(p) 0. writerow(eq) p-flush() print(‘compeleted') def checkingname(itu _itre):#works pr=open(osw," at" newline="") r=csv. writer(pr) cr=int(input( enter roll no" )) us=input("enter your name ") tria=int(input("enter your grade ---in numbers---")) y=[cr.us,tria,itre,itu] L writerow(y) pr.flush() def appenivane): #works tq=value() f=open(opw,"wt" newline ="") Es CSV. Bet ; ) or i in range(0,len Te all th = int(x[0]): tqlJ=x break l.writerows(tq) f flush( ) def deletealldata(_):#works f=open(opw,"w" ,newline=") s=csv.writer(f) f.flush() d=open(oqw,"w s=csv.writer(d ) f-flus! oe print("deleted all data") . Apt ‘to delete all ,Y to continue") ift—=="Y": Myst snewline=") totalchange() def display (): j=value() rint("authors available") or iuu in J: ; (print(iuu[2 fu=input("enter the thor") for iu inj: if str(iu[2]) == str(fu): print(iu) def totalchange(): ; o=open(orw,"w" newline="") s=csv.writer(o) ideo ' t=open(otw,"w" .newline="") fEcsv.writer(t) t.flush() ; r=open(ouw,"w" newline="") e=csv.writer(r) rflush() print("all deleted") a 5 o= ue=open(str(m),'r') rwr=csv .reader(ue) for im in rwr: oi +=[im] return O1 def fn(w.m): o=open(orw,"at" newline="") s=csy.writer(0) s.writerow(["rollno", wn mw mon name","grade","total no of OUTPUTS: DELETE 0-delete all the data 1-addbook 2-viewbook 3-rentbook 4-returnbook 5-deletebook 6-display the books by author 7-clear all the current work enter the choice number enter the serial no3 enter the name of the bookMATHS enter the name of authorR D SHARMA no.of total books present23 Y to keep adding elementsY enter the serial no4 enter the name of the bookSCIENCE enter the name of authorS L ARORA no.of total books present34 Y to keep adding elementsN enter the Y to continue, Y enter the choice number2 ['1', 'CSC', 'SUMITA ARORA, '21', '21'] ['2', 'CSC PRACTICAL’, 'ARUN KUMAR’, '23', '23'] ['3', 'MATHS', '"R D SHARMA’, '23', '23'] RENT BOOK |['4’, ‘SCIENCE’, ‘S LARORA', '34', '34'] wolcaant [1', ‘CSC’, 'SUMITA ARORA’, '21', '21'] no of books needed200 requried no of books not available try again ,use 21 which is the maximum amt of books available enter the Y to continue, Y O-delete all the data 1-addbook 2-viewbook 3-rentbook 4-returnbook 5-deletebook 6-display the books. by author 7-clear all the current work enter the choice number3 enter the serial no1 [1', ‘CSC’, 'SUMITA ARORA’, '21', '21'] no of books needed14 enter roll no12 enter your name SAI enter your grade ---in numbers---12 compeleted VIEW Conclusion: For day to day problems can be resolved with the help of coding and python is one of the best coding application due to it is peculiar features: They are: User friendly Free to use Interactive application Python can be used for various-application just like that of library management that this project describes.