whenever I execute this counting words with dictionaries program it is not behaving, someone help me pin point the problem, the count function is not working. No error message, so am guessing the logic
import sys
import sys
def main(): if len(sys.argv)<2: print('using firstfile for word count') else: filename=sys.argv[1] counters={} with open('firstfile.txt','r') as f: print(f.read()) content=f.read() words=content.split() for word in words: word=word.upper() if word not in counters: counters[word]=1 else: counters[word]+=1 for word, count in counters.item(): print(word,count) if __name__=='__main__': main()