Untitled

mail@pastecode.io avatar
unknown
python
2 years ago
604 B
0
Indexable
Never
import csv def addcsv):
f-open("telephone.csv","w"‚newline=" h=['Pid','Brand', 'Cost'] cwriter-csv.writer(f) cwriter.writerow(h)
while i<5:
id=int(input("enter P Id"))
b=input("enter brand name:")
c=int(input("enter cost:"))
trec-[id,b,c] cwriter.writerow(trec)
14=1
f.close.
def readcsv:
f-open("telephone.csv",";") creader=csv.reader(f) for rec in creader:
print(rec)
f.close
def searchesv0:
f-open("telephone.csv ","r")
creader=csv.reader(f)
bname-input("enter brand name to search:")
for rec in creader:
if rec[11=-bname:
print("The cost of phone is :",rec[2])
f.close)
addesv()
readcsv)
searchesv)