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
In this assignment, you will write a program which merges two arrays of positive integers and removes any duplicate entries.
allsm [11]

Answer:3567810

Explanation:

3 0
3 years ago
Write down 5 tips that an office can use to be more sustainable and reduce wastage? Write a description of each one and how it r
Evgen [1.6K]

1 Use water cooler

2 Avoid single use drink container for guests

3 Bring lunches in reusable containers

4 Paper waste reduction

take paperless notes

5 Use both sides of paper while printing, coping and writing

8 0
3 years ago
Which of the following shows data conversion taking place?
PSYCHO15rus [73]

Answer:

C

data converted from double to integer.

7 0
3 years ago
Which word or phrase refers to an increasingly common method of computing and storing files?
Alecsey [184]
The answer is Cloud computing
Hope this helps-
3 0
3 years ago
Read 2 more answers
Assume you're using a three button mouse. to access shortcut menus, you would
Likurg_2 [28]
<span>Normally you would click the right hand/secondary mouse button but you may configure any of the buttons to work within the Keyboard and Mouse section of System Preferences.
Hope this helps:)</span>
6 0
3 years ago
Read 2 more answers
Other questions:
  • Which of the following is a goal of paraphrasing and summarizing?
    14·2 answers
  • Gina's teacher has sent her a Word document that contains the names of all the students who are participating in the
    11·2 answers
  • Okay I need help. In the first picture, the black glasses, that was my vision last year 52:17 135 and my vision now is 52:15 135
    5·1 answer
  • Implement the function pairSum that takes as parameters a list of distinct integers and a target value n and prints the indices
    11·1 answer
  • _______ view focuses on the text and content of a document, without much information on the page layout.
    7·1 answer
  • For a parking payment app, what option would MOST likely connect a user to a third party/external gateway?
    10·1 answer
  • A slide titled Alexander Graham Bell. There are 6 bulleted entries on the slide, and there is a lot of text on the slide. There
    11·2 answers
  • How to transfer word 2019 from one computer to another
    12·1 answer
  • What does it mean to clear a setting in a dialog box?
    14·1 answer
  • A software copyright?​
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!