Write a function that takes a file handle as a parameter

Assignment Help Computer Engineering
Reference no: EM132200070

Question :

Write a function sum_all that takes a file handle as a parameter. The function reads through a file of text and returns a list of the numbers encountered and their sum. Digits that occur within words should be ignored.

For example, for the text in the file "If I were 21 instead of 53 I'd probably punch you in the nose a 2nd time" should return a list of the numbers encountered 21 and 53, along with their sum 74.

You need to only deal with numbers that are surrounded by spaces. Save the function in a PyDev library module named a9_functions.py

Write a program q1.py that test sum_all function and prints/writes the returned values (the list of number returned and with their sum) to the output file output_q1.txt.

10 20 30
40 50 60
90 80 70
11 22 13
14 14 14

Reference no: EM132200070

Questions Cloud

Superficial one-liner comments will not receive credit : How will this change things? In what way is this breaking news? Provide in-depth analysis. Superficial one-liner comments will not receive credit.
Write a main program that tests your function : Write a main program that tests your function with enough test cases to give you confidence in the correctness of your function.
Write a function that takes an array of integers : Write a function that takes an array of integers and the number of elements in the array as parameters and returns the index of the lowest value.
Write a function called rotate that receives an array : Write a function Write a function called rotate that receives an array and its size and shifts the elements of the array by one position to the right.
Write a function that takes a file handle as a parameter : Write a function sum_all that takes a file handle as a parameter. The function reads through a file of text and returns a list of the numbers encountered.
Write a function that takes a network as input : Write a function that takes a network as input, and outputs two vectors, one of which gives the degree or strength of each node.
Health care needs quality improvement : Health care needs quality improvement to make each and every experience for patients safe.
Project cost irr type of capital proportion : Marvelous Manufacturing (MM) generated the following information for its capital budgeting manager:
The psychoanalytic theory of julia kristeva : The abject is similar to the uncanny and comes from the psychoanalytic theory of Julia Kristeva,

Reviews

Write a Review

Computer Engineering Questions & Answers

  Board of your business it network for discussion

In another year, after all projects are completed, you plan to convert back to a volunteer basis with AllTechComm, and to find out more profitable employment, preferably with a major corporation. You are doing all of the research and networking yo..

  Birt is an open source eclipse-based reporting system

BIRT is an open source Eclipse-based reporting system that integrates with your Java/J2EE application to produce compelling reports BIRT provides core reporting features as in report layout, data access and scripting.

  Design an address decoder to implement this arrangement

When designing an address decoder, a block of memory should be mapped onto a boundary equal to its own size. Why?

  How does application security and cryptography are used

How does application security and cryptography are used in your work(Data analyst)500 words. The response must be typed.

  Create a base class for a banking account

Create a base class for a banking account. Decide what characteristics are common for checking and saving accounts and include these characteristics.

  How to compute both the average

Write down a program that declares a vector of real numbers and input values until a 0 is entered. Add the values to the vector by using push_back(), and compute both the average and the maximum value of the numbers. Output the average and the max..

  Write a program that simulates the roll of two dice

Write a program that simulates the roll of two dice using the random number generators. You will call the rand () function once for each dice. Each rand() call will return a number between 1 and 6.

  Determine the number of duplex voice channels per cell

Determine the number of duplex voice channels per cell in the system.Determine the total number of subscribers the system can support.

  Prepare a brief memo explaining system performance

At the end of the systems analysis phase, you studied the economic feasibility of the system and estimated the future costs and benefits.

  Programming assignment

Build a Dictionary on top of a Bag built on top of an

  What is the throughput now

Suppose your system is designed in such a way that your computer needs to wait for some while to check if the channel is clear before transmitting.

  Write a program that prints all powers of two

Write a program that prints all powers of 2 from 20 up to 220. Write a program that reads a number and prints all of its binary digits.

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