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
ddd [48]
4 years ago
15

Write and implement an interactive C program to scan and process a stream of words of a plain text. Your program should start wi

th an empty list of words. (Combinations of blanks, tabs, and newline characters to separate words.) After reading each word from the input stream, check the word for punctuation marks: if the first letter of the word is preceded or the last letter is followed by punctuation marks, delete punctuation marks from the word if a word contains punctuation marks in the middle, ignore the letters beyond these punctuation marks. For example, if the word is fish, (fish comma) then the resulting word should be fish however, if the word is fish_net then the resulting word would be fish.
Computers and Technology
1 answer:
Wittaler [7]4 years ago
5 0

Answer:

(c) A list of words

Explanation:First let's format the code properly

fin = open('words.txt')

for line in fin:

    word = line.strip()

    print(word)

Second, let's explain each line of the code

Line 1:

The open() function is a built-in function that takes in, as argument, the name of a file, and returns a file object that can be used to read the file.

In this case, the name of the file is words.txt. Therefore, the variable fin is a file object which contains the content of the file - words.txt

Line 2:

The for loop is used to read in each line of the content of the file object (fin).

Line 3:

Each line of the contents is stripped to remove any trailing and leading white spaces by calling on the strip() function. The result of the strip is stored in the variable word.

Line 4:

The content of word at each of the cycles of the loop is printed to the console.

Therefore,  the overall output of the program is a list of words where each word represents a line in the target file (words.txt)

You might be interested in
Distinguish between the desktop publishing packages and multimedia packages​
maksim [4K]

Answer:

___________________________________________________________

Word processing software is used for working with text, while desktop publishing software involves production of documents that combine text with graphics. DTP software is perfect for making flyers, brochures, booklets. This type of software is usually more advanced than word processing apps.

___________________________________________________________

4 0
3 years ago
PYTHON --- Toll roads have different fees based on the time of day and on weekends. Write a function calc_toll() that has three
Oduvanchick [21]

The toll program illustrates the use of conditional statements;

As a general rule, conditional statements are used to make decisions

<h3>The toll program</h3>

The toll program written in Python where conditional statements are used to make several decisions is as follows:

def calc_toll(hour, morning, weekend):

   toll_fee = 0

   if weekend == False:

       if morning == True:

           if hour < 7:

               toll_fee+=1.15

           elif hour < 10:

               toll_fee+=2.95

           elif hour <= 12:

               toll_fee+=1.90

       else:

           if hour < 3:

               toll_fee+=1.90

           elif hour < 8:

               toll_fee+=3.95

           elif hour >= 8:

               toll_fee+=1.40

   else:

       if morning == True:

           if hour < 7:

               toll_fee+=1.05

           elif hour <= 12:

               toll_fee+=2.15

       else:

           if hour < 8:

               toll_fee+=2.15

           elif hour >= 8:

               toll_fee+=1.10

   return toll_fee

   

Read more about conditional statements at:

brainly.com/question/24833629

#SPJ1

3 0
2 years ago
An accountant initially records adjusting entries in a(n) _____.
Alexus [3.1K]
Journal!
Adjusting entries are changes to journal entries you've already recorded.
4 0
3 years ago
_______ consists of the programs that control or maintain the operations of the computer and its devices.
Jet001 [13]
The system software consists of the programs that control or maintain the operations of the computer and its devices.
7 0
3 years ago
Describing Work Activities for Architects
Fiesta28 [93]

Answer:

inspecting equipment, structures, or material

performing general physical activities

getting information

Explanation: i just did it soooo :]

3 0
3 years ago
Read 2 more answers
Other questions:
  • The IP address 129.53.82.20 falls under what class of IP addresses??
    5·2 answers
  • BITS wants to store information about the supervisors, including their supervisor number and the relationship to consultants. Su
    15·1 answer
  • Keep a log of the different types of communication activities in which you engage during the rest of the day. Categorize each ac
    14·1 answer
  • Question 5 (10 points)
    12·1 answer
  • Select one of the following strategies: active listening, sandwich technique, constructive feedback. in 2-5 paragraphs, define a
    11·1 answer
  • A vector is based on...​
    9·1 answer
  • You have important data on your hard drive that is not backed up and your Windows installation is so corrupted you know that you
    11·1 answer
  • Why is there no I do you time of day when all students should study
    10·1 answer
  • Convert each of the fo" wing base ten representations to its equivalent binary form a. 6 b. 13 C. d. 18 e. 27
    6·1 answer
  • What three values must be added to the ipv4 properties of a nic in order for a computer to have basic connectivity with the netw
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!