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

  Opening the "create and manage publications"

This project would challenge you to set up replication on your SQL Server installation. Every step to complete this process is not laid out for you here. Complete the steps and document your choices throughout the process with screen shots and exp..

  Write a method to translate an expression from postfix

Write a method to translate an expression from postfix form into prefix form. Use the C++ conventions of this chapter.

  How many database requests can you identify

Suppose you are a manufacturer of product ABC, which is composed of components A, B, and C. Component A is further composed of parts X and Y.

  How is geospatial analytics employed at great clips

How is geospatial analytics employed at Great Clips? What criteria should a company consider in evaluating sites for future locations?

  E-commerce transaction

Question 1: Suspicious e-commerce transaction includes orders placed by a customer in one country that are shipped to another country. In fact there are no such orders in the Northwind db,  so create a few by modifying some of the "Germany

  Write program that determines a meeting room is in violation

Write a program that determines whether a meeting room is in violation of fire law regulations regarding the maximum room capacity.

  How does size of a key affect strengths of an encryption

How does the size of a key affect the strengths and weaknesses of an encryption technique? Consider both a friendly use of key and an unfriendly use of the key.

  Give an example of an anomaly that is solved

Why are non-database approaches to data management impractical? How does the database solve these problems? Provide a specific example of an anomaly that is solved by a database.

  Determine which general type data structure is appropriate

For each of following description of data, determine which general type of data structure (record, hierarchical record or direct file of record) is appropriate.

  Prepare a high level training program for the end users on

Suppose you are working on a project and you are required to create a high level training program for the end users on how to use your final project.

  Write a function to do a quicksort on a list

Write a function to do a bubble sort on a list. Write a function to do a quicksort on a list. How many times will the following code print out the message?

  What is the difference between a clock cycle and a bus cycle

The 68000 has three interrupt request inputs, IPL0*--IPL2*, that indicate the level of the interrupt request. Because peripherals have a single interrupt.

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