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]
2 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]2 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
A high-angle shot is the same thing as a bird’s-eye shot. True False
mariarad [96]
I believe that is false, but note I could be wrong.
7 0
2 years ago
Read 2 more answers
What is the condition for setting an alarm clock
stich3 [128]

Answer:

The time in which the alarm clock will sound

Explanation: Hope this helped please give me brainliest

6 0
2 years ago
Evaluating how current, credible, and unbiased a source is ensures:
Tanya [424]

The answer is

A. your information is more accurate and useful

I hope it helps you. Please mark me brainliest answer.

6 0
2 years ago
Which three pieces of information should be included in an artist statement? Select all that apply.
Dima020 [189]

Answer:

There is no answers given??

Explanation:

N/A

4 0
2 years ago
Successful Web sites such as StumbleUpon ( www.stumbleupon) and Digg ( www.digg) use ____ by inviting their visitors to vote on
aliina [53]

Answer:

"Crowdsourcing" is the correct answer for the above question.

Explanation:

  • Crowdsourcing is a term from which any organization advertises the thinks or can get the ideas or solutions for any particular problem.
  • It is a term that refers to the problem to the number of solvers to achieve the result correct and frequent.
  • For example, If anyone wants to prepare the two websites. Then he assigns the works to the number of people and the works done faster with the help of this.
  • The above question states that some websites can be successful with the help of the type of work. They are successful with the help of crowdsourced work. Because it saves time. So the answer is Crowdsourcing.
3 0
3 years ago
Other questions:
  • You're working at a large industrial plant and notice a tag similar to the one shown in the figure above. Which of the following
    5·1 answer
  • The ____ button resets slide placeholders to their default position, size, and text formatting.
    11·1 answer
  • python A year in the modern Gregorian Calendar consists of 365 days. In reality, the earth takes longer to rotate around the sun
    15·2 answers
  • A sequence of one or more characters is called
    14·1 answer
  • Why do you classify computers?
    6·1 answer
  • How to program a game​
    7·2 answers
  • Write a program that accepts any number of scores ranging from 0 to 10
    14·1 answer
  • Why optical disk is slower than magnetic disk.?​
    9·2 answers
  • How many hours do you spend on the Internet per day?
    11·2 answers
  • In the EXPLORE online library, the ratio of the number of novels to that of dictionaries is 2:3 and the total number of novels i
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!