Answer to Question #231115 in Python for Rachna Pal

Question #231115

Write a function in python to search for details (Phone no and Calls) of those Phones which have more than 800 calls from file "phones".


1
Expert's answer
2021-08-31T00:52:23-0400
# dictionary for frequency of each number
frequency = {}


# opening file
data =  open('openfile.txt','r')
for line in data:
    count = frequency.get(line,0)
    frequency[line] = count + 1
    
# finding frequency of items
for i in frequency.items():
    if frquency[i].key() >= 800:
        print(frequency[i])

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS