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
tia_tia [17]
3 years ago
14

Write a shell (text-based) program, called first_word.py, that opens the file stuff.txt and prints out the first word of every l

ine except the first line.
For example, if stuff.txt has the following sentences:

We are hungry.
There is an apple.
There is an orange.
Now we are thirsty.
Then the following example output would happen.

PS C:\Users\ssiva\Desktop> python first_word.py
There
There
Now
PS C:\Users\ssiva\Desktop>
Computers and Technology
1 answer:
postnew [5]3 years ago
3 0

Answer:

See explaination

Explanation:

Please check below for the code for first_word.py file which will print first word of an input file stuff.txt. So the open function will open file in read mode. We had maintained a count variable so that we can skip printing first word of first line. Also the command line.strip() checks whether string is empty or not so that we will not get index error while calling split function over line to get first word.

#!/usr/local/bin/python

stuff = open("stuff.txt", "r");

count = 0;

for line in stuff:

count+=1;

if (count>1 and line.strip()):

print(line.split(maxsplit=1)[0])

You might be interested in
Which of the following could be useful during system testing?
Semenov [28]

Answer: Stubs, data flow analysis, capture-replay tools and mock object are useful during the system testing.

Explanation:

Stubs hold the predefined data and used it to answer calls during testing. Stub act as an object and test scrub simulated the charactertics of software components.

Data flow analysis used in the programming of software components by using the control flow graph. It basically focused on the data variable and their definite values. It is used in the form of whitepox testing.

Capture replay tool is used as aggression development test and during testing it records all the events. By using playback it also compared the results in the testing.

Mock object are used to verified all the expected results and behavior during testing. Mock objects are mainly used in unit testing.

4 0
4 years ago
Write a method isMultiple that determines, for a pair of integers, whether the second integer is a multiple of the first. The me
NNADVOKAT [17]
I don't know what language you want it in but I will write this in Java.

public int isMultiple(int x, int y) {
    if (x % y == 0)
        return 1;
    return 0;
}

The mod function (%) returns 0 iff x divides y.
Feel free to ask me questions!
3 0
4 years ago
Read 2 more answers
Universal Containers (UC) has a great user interface for their Customer Community Knowledge Base. UC has multiple Communities an
IrinaK [193]

Answer:D

Explanation:

Recreate the knowledge base page in all communities.

3 0
3 years ago
In the classic experimental design, there are two groups: the _____ group and the _____ group.
Tju [1.3M]

Main Answer:In the classic experimental design, there are two groups: the <u>treatment group and the control group.</u>

<u>Sub heading:</u>

<u>Explain treatment group and control group?</u>

Explanation:

1.The treatment group also known as the experimental group receives the treatment that the researcher is evaluating.

2.the control group  on the other hand does not receive the treatment.

Reference link:

https://brainly.com

Hashtag:

#SPJ4

5 0
2 years ago
Definition of the term social factor and explain why texting while driving can be classified as a social factor causing accident
sergij07 [2.7K]
Social factor - Something that affects you!
Texting and driving is classified as a social factor because your phone is the reason why you crashed your car.
8 0
3 years ago
Other questions:
  • How many bits are in 1 tb? [hint: depending on the tool used to calculate this, you may need to use a trick to get the exact res
    6·1 answer
  • Have you ever tried to teach a class full of restless, active sixth-graders? I have. I taught sixth-grade students for 12 years.
    15·1 answer
  • How to highlight text on a kindle paperwhite?
    7·1 answer
  • When you close a file, what happens to the undo history list for that file?
    5·1 answer
  • Presses the Schedulr app icon Selects the list item for CSCI 448 Presses the "View Classroom on Map" button While only performin
    11·1 answer
  • Measuring design attributes is helpful for comparingalternative designs and for predicting:
    11·1 answer
  • A technician receives an invalid certificate error when visiting a website with port 443 enabled. Other computers on the same LA
    8·1 answer
  • When you need to cut new external threads on a bolt, which of the following tools should you use?
    9·2 answers
  • Which feature do we most likely use to quickly change the background, fonts, and layout?
    12·1 answer
  • BRAINLIEST TO RIGHT ANSWER!! TIMED QUIZ HELP ASAP PLS!!
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!