Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

PYTHON PROGRAMMING:

1. Given a file object named output, associate it with a file named year summary.txt by opening the file for appending

2. Using the file object input, write code that read an integer from a file called rawdata into a variable  datum (make sure you assign an integer value to datum). Open the file at the beginning of your code, and close it at the end.

3. A file named numbers.txt contains an unknown number of lines, each consisting of a single positive integer. Write some code that reads through the file and stores the largest number read in a variable  named maxvalue.

4. A file named data1.txt contains an unknown number of lines, each consisting of a single integer. Write some code that creates a file named data2.txt and copies all the lines of data1.txt to data2.txt.
5. Two files named numbers1.txt and numbers2.txt both have an unknown number of lines, each line consisting of a single positive integer. Write some code that reads a line from one file and then a line from the other file. The two integers are multiplied together and their product is added to a variable  called scalar_product which should be initialized to zero.

Your code should stop when it detects end of file in either file that it is reading.

For example, if the sequence of integers in one file was "9 7 5 18 13 2 22 16" and "4 7 8 2" in the other file, your code would compute:

4*9 + 7*7 + 8*5 + 2*18

and thus store 161 into scalar_product.

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M92525223
  • Price:- $20

Priced at Now at $20, Verified Solution

Have any Question?


Related Questions in Computer Engineering

Respond to the statement below in at least 100 words

Respond to the statement below in at least 100 words. Original answers only. If developers are making decisions on the requirements, then how do they know that the software will work properly for the end user? Developers ...

Let x denote the body temperature measured in degrees

Let x denote the body temperature (measured in degrees Fahrenheit) of a human being. Suppose that across all humans, x follows some unknown distribution with mean u and standard deviation o. You want to know u. You colle ...

Use the management studio to create a new database called

Use the Management Studio to create a new database called Membership2 using the default settings. (If the database already exists, use the Management Studio to delete it and than recreate it)

What is the process involved in answering this

What is the process involved in answering this question? Stock Index Performance   On November 27, 2007, The Dow Jones Industrial Average closed at 12,958.44, which was up 215.04 that day. What was the return (in percent ...

Why regulated industries should be required to follow

Why regulated industries should be required to follow security standards. Provide 2 examples of industries that would fall under this category.

Question read the following topic then explain where a

Question: Read the following topic then explain Where a datagram can be fragmented? Where the fragmented datagram can be reassembled? Fragmentation of Datagram Packets used by the IP are called datagrams. For a networks ...

Describe a ping of death attack as an attack that causes

Describe a ping of death attack as an attack that causes the victim computer to freeze and malfunction.

How does a java server page uses the client-server model to

How does a Java Server Page uses the client-server model to make a Web page interactive?

The glen arboretum wants to start removing invasive norway

The Glen arboretum wants to start removing invasive Norway Maple trees. To determine just how bad the problem is you set up five plots that are three meters on each side. You find that your plots have 2, 5, 9, 1, and 3 N ...

Two manufacturing firms are located on the banks of the

Two manufacturing firms are located on the banks of the Crimea River. Riditna Paper withdraws river water for use in its paper mill, and returns it, along with waste effluent, back into the river. (Effluent is a co-produ ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As