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
Korvikt [17]
4 years ago
6

Please construct a program that reads the content from the file numbers.txt. There are two lines in the file, each is an integer

number. Print out the two numbers and their sum in an equation as below: Content in numbers.txt: 45 28 Output of the program: 45 28
Computers and Technology
1 answer:
Mademuasel [1]4 years ago
5 0

Answer:

file = open("numbers.txt")

numbers = []

for line in file:

   numbers.append(int(line))

print("The numbers in the file: " + str(numbers[0]) + " " + str(numbers[1]))

print("The sum of the numbers: " + str(numbers[0] + numbers[1]))

Explanation:

The code is in Python.

Open the file named numbers.txt

Create an empty list, numbers, to hold the numbers in the file

Create a for loop that iterates through file and adds the number inside the file to the list

Print numbers

Calculate and print the sum of the numbers

You might be interested in
Assume that programs spend about 25% of their time waiting for I/O operations to complete. If there are FOUR programs loaded int
natima [27]

Answer:

0.9961

Explanation:

Given that:

Proportion of time waiting for I/O operation to complete = 25% = 0.25

Number of programs waiting in memory = 4

Using the CPU Utilization formula :

CPU Utilization = 1 - p^n

1 - 0.25^4

1 - 0.00390625

0.99609375

5 0
3 years ago
Write a job back with my best Interest
Katena32 [7]

Answer:

be a doctor

Explanation:

u will help people and save them and get paid

6 0
3 years ago
Read 2 more answers
What form of note taking would be MOST beneficial for a visual learner who needs to see the connections between ideas?
Svetlanka [38]

Answer:

Think link

Explanation:

8 0
4 years ago
Sierra owns a small business and handles many responsibilities, from logistics to marketing. She's seen a lot of success with Go
Elenna [48]

Answer:

A Smart Display campaign

Explanation:

She can go for Smart Display Campaign.

4 0
4 years ago
An educational institution has a number of buildings in the campus. Each building has its own independent network system, and al
klemol [59]

Answer:

The answer is C) tree topology

8 0
3 years ago
Other questions:
  • Business ethics are?
    9·1 answer
  • What is another way to use the Help feature in Access 2016?
    15·2 answers
  • "In about 100 words, discuss the technologies that Walmart’s trucking fleet might use to better manage their operations. Include
    7·1 answer
  • When reading words with a scanner object, a word is defined as ____?
    15·1 answer
  • A company decides to relocate its operations to another state in order to take advantage of some new business investment credits
    15·1 answer
  • Your Google Search text ad has three main components. The first is a headline, and the second is a description. What's the third
    14·1 answer
  • Type (dog, cat, budgie, lizard, horse, etc.) Create a class that keeps track of the attributes above for pet records at the anim
    7·1 answer
  • Intelligent transportation systems use GPS to<br> Select all that apply.
    5·1 answer
  • What is a wiki website?
    11·1 answer
  • write a program that computes an integer's checksum. to compute the checksum, break the integer into its constituent
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!