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

  Mathematics in computing

Binary search tree, and postorder and preorder traversal Determine the shortest path in Graph

  Ict governance

ICT is defined as the term of Information and communication technologies, it is diverse set of technical tools and resources used by the government agencies to communicate and produce, circulate, store, and manage all information.

  Implementation of memory management

Assignment covers the following eight topics and explore the implementation of memory management, processes and threads.

  Realize business and organizational data storage

Realize business and organizational data storage and fast access times are much more important than they have ever been. Compare and contrast magnetic tapes, magnetic disks, optical discs

  What is the protocol overhead

What are the advantages of using a compiled language over an interpreted one? Under what circumstances would you select to use an interpreted language?

  Implementation of memory management

Paper describes about memory management. How memory is used in executing programs and its critical support for applications.

  Define open and closed loop control systems

Define open and closed loop cotrol systems.Explain difference between time varying and time invariant control system wth suitable example.

  Prepare a proposal to deploy windows server

Prepare a proposal to deploy Windows Server onto an existing network based on the provided scenario.

  Security policy document project

Analyze security requirements and develop a security policy

  Write a procedure that produces independent stack objects

Write a procedure (make-stack) that produces independent stack objects, using a message-passing style, e.g.

  Define a suitable functional unit

Define a suitable functional unit for a comparative study between two different types of paint.

  Calculate yield to maturity and bond prices

Calculate yield to maturity (YTM) and bond prices

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