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
Predict how digital video will be viewed in the future. Step into the year 2028. How are people viewing digital video? Or have w
Nostrana [21]
<span>Google Glass was interesting; a personal screen overlaid onto the real world, with 'augmented reality' ideas. The Nintendo 3DS was the first 'no glasses' portable 3D system.

So I predict Google 3D Glasses with built in Dolby 9.1 sound emulation. </span>
4 0
3 years ago
Read 2 more answers
Quick SearchLinks to an external site. lets you refine or narrow your search results using links on the right side of the screen
nikdorinn [45]

Answer:

Answer is

By topic, By collection.

Refer below.

Explanation:

Quick SearchLinks to an external site. lets you refine or narrow your search results using links on the right side of the screen. Do a search on wind power. Some criteria that can refine your search results in Quick Search are:

By topic

By collection

5 0
3 years ago
A digital system has been developed to measure temperatures in the range -10˚C to 100˚C. If the accuracy of the system is such t
8090 [49]

If you have 10 bits available then you can interpret any number in range [0,2^{10}-1]=[0,1023].

The system therefore could represent the actual temperature of 39°C.

Hope this helps.

7 0
2 years ago
Write a program that reads a string of characters, pushing each character onto a stack as it is read and simultaneously adding i
sleet_krkn [62]

Answer:

#include <iostream>

#include <stack>

#include <queue>

#include <string>

int main()

{

   while ( true )

   {

       std::string letters;

       std::cout << "Please enter a word (Enter - exit): ";

       std::getline( std::cin, letters );

       if ( letters.empty() ) break;

       std::stack<char>

           s( std::stack<char>::container_type( letters.begin(), letters.end() ) );

       std::queue<char>

           q( std::queue<char>::container_type( letters.begin(), letters.end() ) );

       while ( !s.empty() && s.top() == q.front() )

       {

           s.pop();

           q.pop();

       }

if ( s.empty() ) std::cout << "The word is a palindrome" << std::endl;

       else std::cout << "The word is not a palindrome" << std::endl;

   }

   return 0;

}

Explanation:

A <em>stack</em> is used to replicate a stack data structure in C++  while <em>Queue </em>container is a replica of the queue data structure in C++, Unlike stack, in the queue container, there are two ends, i.e. front, and back.

In the code above to be able to use used stack and queue, we included the headers #include <stack> and#include <queue>.

4 0
3 years ago
(Business: check ISBN-10) An ISBN-10 (International Standard Book Number) consists of 10 digits: d1d2d3d4d5d6d7d8d9d10. The last
Aneli [31]

Answer:

 The solution code is written in Python 3

  1. digits = input("Enter 9 digits: ")
  2. multiplier = 1
  3. total = 0
  4. for x in digits:
  5.    total += int(x) * multiplier  
  6.    multiplier += 1
  7. checksum = total % 11  
  8. if(checksum == 10):
  9.    print(digits + "X")
  10. else:
  11.    print(digits + str(checksum))

Explanation:

Firstly, use input function to get user input for 9 digits (Line 1)

Next we can use a for-loop to estimate the summation (d1 * 1 + d2 * 2 + d3 * 3 + d4 * 4 + d5 * 5+ d6 * 6 + d7 * 7 + d8 * 8 + d9 * 9) ( Line 6-8)

Then only apply % operator to get the remainder of total and get the checksum (Line 10)

Next create if and else statement to print the digits string joined with X if checksum is 10 else join digits string with checksum value (Line 12 -15)

7 0
3 years ago
Other questions:
  • Bullets in a text box will do which of the following?
    9·2 answers
  • The _____ toolbar can be customized to the preferences of the user.
    7·1 answer
  • What are two variables is figure 1 comparing
    10·1 answer
  • Which device makes computers that are connected to separate segments appear and behave as if they're on the same segment? (Pleas
    11·1 answer
  • Do like TikTok??????
    14·2 answers
  • Explain the term game! And give me complete sentences. U can use ur opinion as well!
    11·1 answer
  • Justify any FOUR significant factors to remember when installing your motherboard
    7·1 answer
  • Answer if you know Javascript, html, css, python, and Ruby.
    12·1 answer
  • Would my phone still work if I snapped it in half?
    8·2 answers
  • Simon would have regarded with impotent fury the disturbance between the North and the South, as it left his descendants strippe
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!