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
What is episodic memory? knowledge about words, concepts, and language-based knowledge and facts information about events we hav
tankabanditka [31]

Answer:

<em>information about events we have personally experienced</em>

Explanation:

Episodic memory is <em>the actual memory of a particular event that a person has, so it will be different from the recall of the same encounter or experience by someone else.</em>

Often, episodic memory is mistaken with autobiographical memory, and while autobiographical memory includes episodic memory, it also depends on semantic memory.

<em>For instance, you might know the city you were born in and the date, though you have no particular birth memories.</em>

3 0
3 years ago
A __________ is typically stored in a JAR file and contains one or more packages that you want to make available to other projec
dsp73

Answer:

<u>class -files and auxiliary resources</u>

Explanation:

JAR stands for Java Archive which allows one to make multiple file bundles into a single file which is archive file and these JAR files contains in them the the auxiliary resources and the class files.

The archive file allows us to be storage efficient by compressing our data and files.

These files also allows us to transform our software into extensions as well.

For the enforcement of consistency of version of the packages, these files can be sealed optionally.

6 0
3 years ago
you where discussing software piracy with a friend and were surprised to learn how software piracy can impact your life every da
umka2103 [35]
Ahh, software. What is software piracy?
.
Ok... so it sounds evil.
.
BECAUSE IT IS!!
.
Software piracy can get you and suspected accomplices in court.
.
Fines up to a million dollars and lots of jail time.
.
Lots.
.
And lots.
.
But an effect of software piracy is that the software stealer himself earns money...
.
illegaly.
7 0
3 years ago
he function below takes one parameter: a list of strings (string_list). Complete the function to return a new list containing on
Aleks04 [339]

Answer:

def select_short_strings(string_list):

   new_list = []

   

   for s in string_list:

       if len(s) < 20:

           new_list.append(s)

   return new_list

   

lst = ["apple", "I am learning Python and it is fun!", "I love programming, it is easy", "orange"]

print(select_short_strings(lst))

Explanation:

- Create a function called <em>select_short_strings</em> that takes one argument <em>string_list</em>

Inside the function:

- Initialize an empty list to hold the strings that are less than 20

- Inside the loop, check the strings inside <em>string_list</em> has a length that is smaller than 20. If found one, put it to the <em>new_list</em>.

- When the loop is done, return the <em>new_list</em>

- Create a list to check and call the function

4 0
3 years ago
Read 2 more answers
In unreal engines which class should be used to define the rules of the game
mel-nik [20]

Answer: The number of players and spectators present, as well as the maximum number of players and spectators allowed.

Explanation: players

8 0
3 years ago
Other questions:
  • Which of the following payment types require you to pay upfront A. Money order and credit card B. Money orders and prepaid card
    9·2 answers
  • What do vector handles point at?
    13·2 answers
  • On a Linux system, which command allows you to modify settings used by the built-in packet filtering firewall?
    15·1 answer
  • A girl scout troop with 10 girl scouts and 2 leaders goes on a hike. When the path narrows, they must walk in single file with a
    12·1 answer
  • The fill command try’s to fill or generate content for cells based on a ________.
    15·1 answer
  • 17. What are the basic modes of operation of 8255?Write the features of mode 0 in 8255?
    8·1 answer
  • What is the full form of the OS?​
    15·2 answers
  • Sự ra đời của thương mại điện tử có tác động như thế nào đến việc quảng cáo và Marketing sản phẩm
    11·2 answers
  • The economic importance of computer viruses​
    14·2 answers
  • Multiple Select Which of these are ways a hacker might learn someone's password? Select 3 options. o social engineering keylogge
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!