1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Len [333]
3 years ago
6

A file concordance tracks the unique words in a file and their frequencies. Write a program that displays a concordance for a fi

le. The program should output the unique words and their frequencies in alphabetical order. Variations are to track sequences of two words and their frequencies, or n words and their frequencies. Below is an example file along with the program input and output: example.txt
Computers and Technology
1 answer:
neonofarm [45]3 years ago
3 0

Answer:

Python file with appropriate comments given below

Explanation:

#Take the input file name

filename=input('Enter the input file name: ')

#Open the input file

inputFile = open(filename,"r+")

#Define the dictionary.

list={}

#Read and split the file using for loop

for word in inputFile.read().split():

  #Check the word to be or not in file.

  if word not in list:

     list[word] = 1

  #increment by 1

  else:

     list[word] += 1

#Close the file.

inputFile.close();

#print a line

print();

#The word are sorted as per their ASCII value.

fori in sorted(list):

  #print the unique words and their

  #frequencies in alphabetical order.

  print("{0} {1} ".format(i, list[i]));

You might be interested in
Edible vaccines, a more controversial approach to vaccine development, have been investigated by scientists. Plants can be genet
madreJ [45]
I need some more information. If you need any more help with this please leave a relpy.
8 0
4 years ago
Who developed the idea of a universal network?
polet [3.4K]
Alan Turing fathered the machines we now lovingly call computers, however it was Nicola Tesla that birthed the idea of a world-wide wireless system.
7 0
3 years ago
A microsoft windows os component responsible for representing graphical objects and transmitting them to output devices such as
vaieri [72.5K]
A driver. A driver is basicly and application or component that helps communicate between you computer and a device(a mouse, keyboard, printer etc.) You may have know when you get a new mouse and connect it up, Windows always tries to find a driver and download it. 
5 0
3 years ago
Which osi layer defines the functions of logical network-wide addressing and routing?
IRISSAK [1]
Answer: The Network Layer
5 0
3 years ago
Which of the following is NOT one of the four steps preparing for sales forecast ?
ehidna [41]
Can you post the answers plz
4 0
3 years ago
Other questions:
  • Mara's presentation included essential information about the company's new safety procedures. She wanted to make
    13·2 answers
  • Lucinda works at a recycling center. She noticed an increase in glass recyclables entering the center. She collects data regardi
    7·2 answers
  • Write a program to generate personalized junk mail. The program takes input both from an input file and from the keyboard.The in
    14·1 answer
  • What functions do these WLAN applications and tools perform on WLANs: airmonng, airodump-ng, aircrack-ng, and aireplay-ng
    10·1 answer
  • What soft ware can you use to erase all of your data from a hard drive safely
    13·1 answer
  • Write 4 types of viruses , explain them briefly.
    7·1 answer
  • What is also known as computer Network?
    6·2 answers
  • What are styles? built-in conditional formatting rules formatting applied with the Format Painter defined combinations of format
    15·2 answers
  • Write a program to demonstrate circular linked list with operations using pointers – insert
    13·1 answer
  • Customer history is an example of what
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!