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
In financial language, a “quarter” is one quarter of a year, or three months. Your annual sales are $123,000. The sales are spre
OLga [1]
Divide $123,000 by 5 and get
24600
8 0
3 years ago
Read 2 more answers
25-words or more in your OWN words the meaning of digital literacy.
jolli1 [7]

Answer:

Digital literacy means having the skills you need to live, learn, and work in a society where communication and access to information are increasingly through digital technologies like internet platforms, social media, and mobile devices.

Explanation:

6 0
3 years ago
When a sentinel is used in a (______/posttest) loop to validate data, the loop repeats as long as the input is (valid/______). p
monitta

Answer:

When a sentinel is used in a (pretest/post test) loop to validate data, the loop repeats as long as the input is (valid/invalid).

Explanation:

Required

Fill in the gaps

Sentinel are used to validate or invalidate loops (pretest and post test loops).

Since , some parts of the brackets have aready been filled, we simply complete the blanks with the opposite of the term in the bracket. i.e. the opposite of post test is pretest and the opposite of valid is invalid.

<em>So, the blanks will be filled with pretest and invalid.</em>

4 0
3 years ago
Will mark brainliest plzz help
n200080 [17]

Answer:

planes

rendering engine

coordinate

frame range

i could be wrong....

5 0
3 years ago
How do engineers communicate their design ideas?
Nady [450]

Answer:

Explanation:

Mechanical engineers give Presentations when they work on projects and Proposals. Often, professional Presentations require you to verbally and graphically present preliminary designs to colleagues.

Hope this helped!!!

5 0
4 years ago
Other questions:
  • You have no control over who views your social network information
    13·2 answers
  • What is the recommended solution to configure this automated behavior? UC has a requirement that an opportunity should have a fi
    8·1 answer
  • Computer science
    6·1 answer
  • During wave motion, the motion of particles to one side of the rest position will be______ the motion to the other side of the r
    12·2 answers
  • Refer to the exhibit, a technician applies the configuration in the exhibit to an unconfigured router. To verify the configurati
    13·1 answer
  • What kind of sampling does a quasi experiment use?
    11·1 answer
  • What is the definition of software? Group of answer choices an instruction that causes a single specific action to be performed
    11·1 answer
  • What are QBASIC Operators ?​
    11·2 answers
  • Scenes for films are almost always filmed in the same sequence they appear in the script.
    14·1 answer
  • What are the steps involed in accepting all the changes in a document?
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!