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
Item 8 Item 8 Shelby Black runs a very successful hair salon in downtown Los Angeles. One of Shelby’s tasks is to input positive
Nadusha1986 [10]

Answer: Feedback

Explanation: Feedback is the reaction obtained in the form of information from the task a person has performed or any product. It gives the review of the service that is given by the customer, user etc.The reaction that is obtained can be a negative feedback or positive feedback.

Both types of feedback is necessary because it helps in the improvement of the service. The negative reaction will helps to change/improve the service that is not liked by the customer and positive feedback tells about the services appreciated by the customer. So, Shelby is also keeping the feedbacks for the same purpose for her salon business.

8 0
3 years ago
What do you call the quality of information
Kobotan [32]

Answer:

"Information quality" is a measure of the value which the information provides to the user of that information. accuracy, objectivity, Believability, reputation.

Explanation:

8 0
3 years ago
Ano ang bunga ng pagsunod sa tamang konsiyensiya?
gladu [14]

Answer:

A.

Explanation:

mapalaganap ang kabutihan

8 0
3 years ago
Read 2 more answers
I need help making this table in html code I have some of chart done but idk where to go after the 6:30pm part
Bumek [7]

dvioubfeevuf is hsvqvuvsqv

5 0
3 years ago
What are some characteristics of filtering junk email in Outlook 2016? Check all that apply.
Mashcka [7]

Answer:oof

Explanation:

4 0
3 years ago
Read 2 more answers
Other questions:
  • At what point is an idea protected by copyright?
    7·2 answers
  • All the computers in this type of network are connected to two other computers.
    12·1 answer
  • Which statement best represents the denotation for the word “woman”? A woman is an adult human female. Both man and woman are re
    11·2 answers
  • #include <iostream>
    9·1 answer
  • Wich technology can a website use to allow you to listen to a concert live over the internet?
    10·1 answer
  • People using commercially available software are usually asked to read and agree to a(n) _____
    10·1 answer
  • 2.8 Code Practice: Question 2
    11·1 answer
  • In 1980, IBM's cheapest computer was more affordable than Apple's.<br><br><br> True<br><br> False
    10·1 answer
  • Post back maintains view state by assigning the form values to a hidden form field named ____.
    12·2 answers
  • The new software analyzes sales conversion per sales in a way intended to increase sales success. what is the first thing you mu
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!