Given a file object named output

Assignment Help Basic Computer Science
Reference no: EM131716531

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.

Reference no: EM131716531

Questions Cloud

Discuss what are your possible courses of action : As the social worker in this county agency, how would you respond in this situation. What are your possible courses of action
Analyze the ways in which culture defines gender : Philosopher and gender theorist Judith Butler's queer theory is based on the central concept that gender is real only to the extent that it is performed.
Create a powerpoint presentation summarizing aspects : create a PowerPoint presentation summarizing each of these aspects. In addition, you will need to provide one figure of your choice that illustrates
Define the various methodologies for sociological research : Define the basic concepts used in the discipline of sociology. Define the various methodologies for sociological research.
Given a file object named output : 1. Given a file object named output, associate it with a file named year summary.txt by opening the file for appending
Code a python module : Code a Python module (mystdio.py) with the following function signatures:
What is the effect on the proletariat class : Karl Marx once referred to Religion as the opiate of the masses. I would like to hear your responses to this and what he meant exactly.
How was wundt''s psychology influenced by the preceding : How was Wundt's psychology influenced by the preceding and/or current work of the predominantly British empiricists
Screenshot of the output formatted : Please keep in mind this has to be done in Python. Also a screenshot of the output formatted would be much appreciated

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Array of monthly sales figures

Write a C++ program using pointers that will create dynamically allocated array of monthly sales figures whose size has been input by the user. After prompting the user to input the sales figure, it will find the highest monthly sales amount and t..

  Experiment with computer system measurements

Platform. Pick a Unix-based platform to work on. This might very likely be something like a PC running Linux, but feel free to experiment with whatever system you have access to, e.g., FreeBSD, some old UNIX system like AIX, or even Mac OS X.

  Discuss and share rich and diverse assortment of reference

Discuss and share the rich and diverse assortment of reference sources for the Bourne Again Shell (BASH).

  Discuss the balance between absolute truth

¨Discuss the balance between absolute truth and using data to reach a particular goal?

  Create other test cases and test functions for the play_hand

Create other test cases and test functions for the play_hand () function

  A korean translated version of an excel file need editing

A Korean translated version of an excel file need editing and manipulation according to its specified command :  sheet 2: use SUMIF and COUNTIF command sheet 3: use IF and Rank command

  What is the reconstructed signal xa(t)

If is passed through an ideal D/A converter, what is the reconstructed signal xa(t)?

  Examine the challenges of developing erp system

Examine the challenges of developing ERP system

  Determine the diameter of the exit pipe

Refrigerant 22 enters the condenser of a refrigeration system operating at steady state at 12 bar, 50°C, through a 2.5- cm-diameter pipe. At the exit, the pressure is 12 bar, the temperature is 28°C, and the velocity is 2.5 m/s. The mass flow rate..

  Compute whether the year is leap or not

Write a program that asks the user for a year and computes whether that year is a leap year. Implement a class Year with a predicate method boolean isLeapYear().

  Average of the values in an array of doubles

Question 1: Write a method that computes the average of the values in an array of doubles. The header of the method is as follows:

  Describe a scenario that would qualify for a rating of 1

The software used by the acquiring bank is relatively new, and only about a third of the project team is familiar with it. Your task is to determine a DPCI rating for the familiarity of the project team with the technology.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd