Post your solutions in the comments section below.
10 Aug 2023
Share
Recent Comments
Daniel says:
import re
emails = []
count = 0
cols = []
it=0
with open("100-contacts.csv", "r") as f:
text = f.readline()
hd = re.split(r",", text)
for i in range(len(hd)):
print(hd[i])
if(re.search(r"county", hd[i])):
cnt = i
while(text):
text = f.readline()
Daniel says:
import re
emails = []
count = 0
cols = []
it=0
with open("100-contacts.csv", "r") as f:
text = f.readline()
hd = re.split(r",", text)
for i in range(len(hd)):
print(hd[i])
if(re.search(r"county", hd[i])):
cnt = i
while(text):
text = f.readline()
if(text==""):
break
cols.append(re.split(r",", text))
#print(cols[cnt])
if(cols[it][cnt]=="Los Angeles"):
count = count + 1
it+=1
print(count)
Pragati Agrawal says:
https://colab.research.google.com/drive/19sCCy0qANSXyxdTDxnRG6jwy0YZlk3fq?usp=sharing