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 option can Jesse use to customize her company’s logo, name, address, and similar details in all her business documents?
solniwko [45]
The option which Jesse can use to customize her company loge is the CUSTOMIZATION OPTION.
This option allows the user to edit personal information according to the user desires. Depending on the need of each user, the option can be used to emphasize the information that one want to highlight.
6 0
3 years ago
What is an example of using the internet of things (iot) to deliver innovative cloud-based solutions to customers?
Elina [12.6K]

Answer:

Wearable technology

Explanation:

An example of using the Internet of Things (IoT) to deliver innovative cloud-based solutions to customers is the wearable technology that provides customers with on-the-spot personalized experiences.

4 0
2 years ago
HELP PLZ ;(
Keith_Richards [23]
The answer is B or you could click when the pop up
8 0
3 years ago
Read 2 more answers
Which IDS/IPS detection method uses previously gained connection attributes to match traffic against predetermined profiles
natulia [17]

Answer:

Stateful protocol analysis detection.

Explanation:

IDS and IPS are acronym for intrusion detection system and intrusion prevention system respectively. IDS is a security system which monitors the network traffic and notifies the engineer when there's a malicious activity. IPS is a security system which monitors the network traffic and blocks malicious activity as well as keeping logs.

Generally, the detection methods used by the Intrusion Prevention Systems (IPS) are;

1. Statistical anomaly-based detection.

2. Signature-based detection.

3. Stateful protocol analysis detection.

Stateful protocol analysis detection is an IDS/IPS detection method that uses previously gained connection attributes to match traffic against predetermined profiles.

Basically, these predetermined profiles comprises of benign activities and suspicious activities that have been developed by industry leaders and vendors as abnormal systems or network behaviors.

6 0
3 years ago
You are able to drag a cell to a new location by pointing to the cell border until the pointer displays a _______ arrow, and the
ivann1987 [24]
I think its D, double-headed if I remember right. If this is brainiest can you mark it, please! I am trying to rank up. Thanks, hun!
7 0
3 years ago
Read 2 more answers
Other questions:
  • 6. When should you return to the right lane after passing another car on the left?
    14·2 answers
  • What does CSS stand for?
    8·2 answers
  • What does a computer user need to know about programming in order to play a video game?
    6·2 answers
  • Which notification appears on the screen when a new Outlook item arrives?
    10·1 answer
  • What are the pros and cons of the internet’s ability to access information
    8·2 answers
  • Which ammunition security category includes fragmentation grenades mines and explosives?
    5·1 answer
  • Write a single if-test using Boolean operators and relaional operators to determine if a double variable x is between zero (excl
    11·1 answer
  • In 1997, microsoft was accused of using a monopoly in operating systems to control the market for _____.
    8·2 answers
  • Biosolids are used as a chemical free natural choice for fertilizing.
    5·1 answer
  • What is a decryption key?​
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!