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
15)Which of the following statements is generally true about a V8 engine...
Vladimir79 [104]

Answer: Generally, there is an increase in power with a V8 engine.

Explanation:

A V8 engine has a bigger engine that cars with a V4 or V6 engines. They can go faster and gain speed at a faster rate than the other cars. They are not good on gas and use more gas than other cars with smaller engines.

Two things that are great about having a V8 engine is the torque and the power output. One of the most powerful engines with a V8 is a Dodge Challenger SRT. These engines are usually in bigger trucks and sports cars.

7 0
3 years ago
Write the full forms of the following:
Grace [21]

Answer:

The abbreviation of the given points is described below.

Explanation:

  • GIGO stands for "Garbage In/Garbage Out".
  • MHz stands for "Megahertz".
  • BBS stands for "Bulletin Board System".
  • CBT stands for "Computer-based training".
  • KB stands for "Knowledge Base".
  • ICU stands for "Intensive Care Unit".
  • CAI stands for "Common Air Interface".
  • WBT stands for "Web-based training".
  • IPM stands for "Intel Power Monitor".
  • CAS stands for "Channel Associated Signaling" and "Customer Alert Signal".
  • ICT stands for "Information and Communication Technology".
  • ATM stands for "Automatic Teller Machine".
5 0
3 years ago
Normalize the following relation:
lora16 [44]

Answer:

Hi Riahroo! This is a good question on the concept of relational databases.

We can normalize the relations as follows:

Flight

(flightnumber (unique), flighttime, airline_id, departure_city, arrival_city,  passenger_id, pilot_id, airplane_id)

has_one_and_belongs_to :airline

has_many :passengers

has_one :pilot

Itinerary(passenger_id, flight_id)

Belongs_to  

Passenger_details  

(passengername (unique), gender, date_of_birth)

has_many :flights

Pilot

(pilotname (unique), gender, date_of_birth)

has_many :flights

airline(airlinename)

airplane(planeID, type, seats))

Explanation:

To normalize a relation, we have to remove any redundancies from the relationships between database objects/tables and simplify the structure. This also means simplifying many-to-many relationships. In this question, we see there is a many-to-many relationship between flights and passengers. To resolve this we can introduce a join table which simplifies this relationship to a one-to-many between the objects.  

5 0
3 years ago
For the question below, refer to the following recursive factorial method.
Romashka-Z-Leto [24]

Answer:

B) (x<=1)

Explanation:

Though this code given will run perfectly without any requirement of base case.But still we have to include a base case I will suggest (x<=1) because the value of x is decreased by one at each recursive call so it can handle it very well and it can handle negative values of x also if user enters it by mistake since factorial is for positive numbers only.

7 0
3 years ago
________ technology uses radio frequency identification (RFID) tags to identify and monitor the movement of each individual prod
Agata [3.3K]

Answer:

The correct answer to the following question will be Option A (​EPC (Electronic product code)).

Explanation:

  • The EPC is built as a global identifier providing, for all time, distinct identity for any physical thing anywhere in the world.
  • This technology enables the use of RFID tags to classify and track the resistance of every other individual item.

No other alternative will be capable of performing these activities or use the RFID tags in any other way. So choice A is the correct answer.

4 0
3 years ago
Other questions:
  • Lionbridge theory test
    6·2 answers
  • If you are unsure about what is or isn’t appropriate to wear to a new job, what is the best thing to do?
    13·2 answers
  • Why a design that doesn't fail initially fails after some time/use? identify at least 3 such mechanisms?
    9·1 answer
  • Which sentence uses a pair of synonyms? Because there was so much shouting, many of the protestors began screaming in order to b
    6·2 answers
  • Write a program to display the roll number of students who have scored 100 in math. display appropriate message if none have sco
    5·1 answer
  • WHAT DOES INFORMATION TECHNOLOGY DO??<br> Do they offer services or products
    15·1 answer
  • A diagnostic program built into a computer to test the hardware components before the computer boots up
    11·1 answer
  • Write a function that dynamically allocates an array of integers. The function should accept an integer argument indicating the
    8·1 answer
  • PLS HELP ASAP!! which of these would be easier to do in a database program than a spreadsheet program? check all of the boxes th
    5·2 answers
  • Online platforms that allow users to represent themselves via a profile on a web site and provide and receive links to other net
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!