0% found this document useful (0 votes)
7 views8 pages

Ankit Doc

The document is a project report by Ankit Negi from St. Columbus School for the Computer Science subject, focusing on phone data management using Python. It includes acknowledgments, a certificate of completion, and a code implementation for managing phone records with functionalities like input, output, search, modify, and delete. The project utilizes the pickle module for data storage and retrieval in a binary file format.

Uploaded by

ash588979
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views8 pages

Ankit Doc

The document is a project report by Ankit Negi from St. Columbus School for the Computer Science subject, focusing on phone data management using Python. It includes acknowledgments, a certificate of completion, and a code implementation for managing phone records with functionalities like input, output, search, modify, and delete. The project utilizes the pickle module for data storage and retrieval in a binary file format.

Uploaded by

ash588979
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 8

ST.

COLUMBUS SCHOOL
TOPIC: PHONE

SUBJECT: COMPUTER SCIENCE


SESSION 2023-2024

NAME- ANKIT NEGI


CLASS/SEC – XII-A
ROLL NO.-

Acknowledgement
I thank my Computer Science teacher Ms. Shweta Siddha for guidance and support. I
would also like to thank my parents and my friends for encouraging me during the course
of this project. Finally I would like to thank CBSE for giving me the opportunity to
undertake this project.

NAME: - ANKIT NEGI


CLASS SEC: 12th- A

Certificate
This is to certify Ankit Negi of Class XII A, St. Columbus School, Dayal Bagh, Faridabad
has successfully completed this project in computer practical as prescribed by CBSE in the
year 2024-2025.

Date: 18/11/2024

Signature of Internal Signature of External


Examiner Examiner

CODINGS
import pickle
import sys
from os import remove, rename,path

def display(x):
print("\tPRODUCT MODEL - ", x['p model'])
print("\tPRODUCT NUMBER - ",x['p number'])
print("\tIMEI - ",x['imei'])
print("\tSTORAGE - ",x['storage'])
print("\tRAM - ",x['ram'])
print("\tPRICE - ",x['price'])
print("\tBATTERY CAPACITY - ",x['battery'])
print("\n\n")

def input_rec():
if path.exists("phone.dat"):
print("File Found")
f=open("phone.dat","ab")

else:
print("File Not Found")
print("Creating a file ..")
f=open("phone.dat","ab")
m=input("ENTER PRODUCT MODEL - ")
n=input("ENTER PRODUCT NUMBER - ")
i=eval(input("ENTER IMEI NUMBER - "))
s=input("ENTER INTERNAL STORAGE - ")
r=input("ENTER RAM - ")
p=eval(input("ENTER PRICE - "))
b=input("ENTER BATTERY CAPACITY - ")

rec={'p model':m,'p number':n,'imei':i,'storage':s,'ram':r,'price':p,'battery':b}

pickle.dump(rec,f)
print("Record Inserted")
f.close()

def output_rec():
f = open("phone.dat","rb")

try:
while True:
x = pickle.load(f)
display(x)
except:
f.close()

def search_model():
fo=0
f=open("phone.dat","rb")
md=input("Enter the model to be searched - ")

try:
while True:
x=pickle.load(f)
if x['p model']==md:
display(x)
fo=1
except:
f.close()
if fo==0:
print("Record not found")

def search_ram():
fm=0
f=open("phone.dat","rb")
rm=input("Enter the ram you want in your phone - ")

try:
while True:
x=pickle.load(f)
if x['ram']==rm:
display(x)
fm=1
except:
f.close()
if fm==0:
print("Record not found")

def search_battery():
fn=0
f=open("phone.dat","rb")
rb=input("Enter the battery you want in your phone - ")

try:
while True:
x=pickle.load(f)
if x['battery']==rb:
display(x)
fn=1
except:
f.close()
if fn==0:
print("Record not found")

def modify_rec():
fr=open("phone.dat","rb")
fw=open("new_phone.dat","wb")
mn=input("Enter the model name to be updated - ")
try:
while True:
x=pickle.load(fr)
if x['p model']==mn:
x['price']=eval(input("ENTER PRICE - "))
pickle.dump(x,fw)
except:
print("Records updated")
fr.close()
fw.close()
remove('phone.dat')
rename('new_phone.dat','phone.dat')

def delete_rec():
fx=open("phone.dat","rb")
fz=open("new_phone.dat","wb")
mn=input("Enter the model name to be deleted - ")
fou=0
try:
while True:
x=pickle.load(f)
if x['p model']==mn:
fou=1
else:
pickle.dump(x,fz)

except:
fx.close()
fz.close()
if fou==1:
print("Records deleted")
remove('phone.dat')
rename('new_phone.dat','phone.dat')

r='y'
while r.lower()=='y':
print("\n\n")
print("MAX STORES")
print("1. Enter New Record")
print("2. Display All Records")
print("3. Search Your Records")
print("4. Update Your Record")
print("5. Delete Any Record")

c=eval(input("Enter your choice from above option - "))


if c==1:
input_rec()
if c==2:
output_rec()
if c==3:

print("Searching records by:- ")


print("1. By model")
print("2. By ram")
print("3. By battery")
s=eval(input("Enter the choice from above option - "))
if s==1:
search_model()
if s==2:
search_ram()
if s==3:
search_battery()
if c==4:
modify_rec()
if c==5:
delete_rec()
r=input("Do you want to continue (y/n) - ")
THANK YOU

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy