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
HELP!!!!!!!
Savatey [412]

Answer:

mouse - input

printer - output

keyboard - input

speakers - output

headset - both

6 0
3 years ago
When a computer is suffering from a virus, you can use a compiler to help remove the virus. True or false?
ipn [44]
True I think because it helps right?
8 0
3 years ago
The benefit from dividing code into methods known as ________ is gained as follows: After you write code to perform a task once,
Fynjy0 [20]

Answer: B: Divide and Conquer

Explanation:

7 0
3 years ago
1.which screen appears after the password is typed (welcome, lock)​
jenyasd209 [6]

Answer:

it should be the welcome screen I will hope so lol

4 0
2 years ago
Read 2 more answers
Select the true statement from the choices below. Group of answer choices Invalid code may cause browsers to render the pages sl
IrinaK [193]

Answer:

(A) A web page will not display in a browser unless it passes syntax validation testing.

(C)A web page must pass syntax validation testing before it is used.

Explanation:

A website is a collection of related web pages. A web page is an electronically arranged content page, designed and developed using web development application and language tool and hosted on a web server.

Web page or application development follows a series of well defined stages called software development life cycle (SDLC). The web application must go through these processes from birth to the end-of-life of the application.

The validation testing in SDLC, consisting of unit, acceptance and loading testing, which checks for syntax error or bugs on the written codes, because bugs could slow the loading of the page or even the display and browser compatibility of elements in the code.

5 0
3 years ago
Other questions:
  • A web page created expressly in hopes of ranking well for a term in a search engine's organic/non-paid listings and which itself
    7·1 answer
  • A cast is required in which of the following situations? a. using charAt to take an element of a String and store it in a char b
    7·1 answer
  • A ____ client locates all or most of the processing logic on the server.
    11·1 answer
  • Match the job titles to the tasks
    11·2 answers
  • John was carrying on at the water cooler the other day, trying to show off his knowledge of networking. He claimed that the comp
    10·1 answer
  • Write a script that will read from a file x and y data points in thefollowing format:
    9·1 answer
  • Need answer ASAP
    8·2 answers
  • Help me with this two questions please
    15·1 answer
  • Many people are scared of the rise of Artificial Intelligence (AI). Do you think computers that are controlled by an AI are some
    11·2 answers
  • The database cannot be migrated to a different engine because sql server features are used in the application’s net code. The co
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!