Write a function named file_sum that takes as a parameter the name of a text file that contains a list of numbers, one to a line, like this: 23.77 116 94 -12.8 0 14.999 The function should sum the values in the file and write the sum (just that number) to a text file named sum.txt.
Q: Exercise 3: Multi-way Trees A way to reduce the height of tree and ensure balance is to allow…
A: Solution- In the given solution , the B - tree insert one by one elements with maximum keys of 4 and…
Q: What are the tools/technology of smart student monitoring system
A: There are several tools and technologies for smart student monitoring system available: 1. Biometric…
Q: Exercise 1: Pre-sorting Consider the problem of finding the distance between the two closest numbers…
A: solution
Q: This question does not have an answer???
A: The java program is given below:
Q: Assuming that the stack called "names" is defined as below, please answer the following questions:…
A: Solution- According to the first table the result is-
Q: The answer is inco
A: This is very simple. Here is the complete and correct solution. ¬(p ∨ (q ∧ ¬r)) ∧ q = (¬p ∧ (q ∨…
Q: Show the steps of insertion sort following the example of the solved problems on the handout for the…
A: The given below program is in java.
Q: With your understanding, what do you anticipate to be the challenges of a mobile company and a…
A: Mobile:- An individual can place and receive calls on a mobile phone, which is a wireless handheld…
Q: What is User Acceptance Testing (UAT)? Explain with Examples
A:
Q: What is power supply unit?
A:
Q: VConstruct a truth table based on the following Boolean expressions below: F = (A' + B' + C') (A +…
A: The following is the direct truth table for expression F: A B C…
Q: 12. You are told that Mouliya purchases 10 oranges when the price of each orange is $0.20. You also…
A: 12. i. In the graph below, price on Y axis and quantity demand on x axis. When price is 0.20 then…
Q: What is AGP slot? What is its use?
A: Accelerated Graphics Port (AGP) High-speed visual output is accomplished using a point-to-point…
Q: Exercises: Q1/ Design a standard project has three forms with backcolors red, blue and green. Q2/…
A: answer:: Step 1- Open Visual Basic with the "Run as administrator" option. Step 2- Select Standard…
Q: What is PCI slot? How is different from PCI Express (PCI-E)?
A: Solution -In the given question, we have to tell what is PCI slot and how it is different from PCI…
Q: Write a program that triples the even integers from 2 through 10 then sum them with IntStream.…
A: The JAVA code is given below with code and output screenshot Happy to help you ?
Q: What is HCI? Explain goals of HCI.
A:
Q: Discuss about entity Human based on following factor II) Attention III) Psychology iv) Ergonomics.
A:
Q: What is Upgrading a microprocessor? Why we have to do it?
A: In this question we need to explain what is microprocessor upgradation of computer system. We also…
Q: Programming exercise (in java eclipse , please add comment for each step)thank you Create a class…
A: The java program is given below:
Q: 53. What is BIOS beep code?
A: "The one and only AwardBIOS beep code signifies a video fault, making it impossible for the BIOS to…
Q: was not looking for code, but rather an explanation
A: Please find the answer below :
Q: a. A main method asks the user to provide the number of rows and columns for a 2-dimensional array…
A: error 404
Q: Passive ROM is usually greater than active ROM, and active ROM usually decreases sooner than…
A: ROM (read only memory) ROM, or read-only memory, is an abbreviation. Computer memory chips that…
Q: 53. What is BIOS beep code?
A: BIOS stands for basic input/output system.
Q: Explain design principles for dealing with error.
A:
Q: Use c programming for the following question. And plz don't use any other libraries other than #…
A: The c program is given below:
Q: This has to be in C++ You want to write a program that will generate accurate shipping charges…
A: The above question is solved in step 2 :-
Q: Q.11 Write a long term memory model script for case given below... An owner went to veterinary…
A: The question has been answered in step2
Q: (5) 3. Diagram a binary search tree created by adding keys to the tree in the following order:…
A: “Since you have asked multiple question, we will solve the first question for you. If you want any…
Q: What CMOS and CMOS battery?
A:
Q: struction: Explain the functions of each code per line to get the desired result. #include using…
A: Introduction: Below explain the functions of each code per line to get the desired result.
Q: Explain the need for frequency reuse, and how this is carried out effectively.
A: Frequency Reuse is the scheme in which allocation and reuse of channels throughout a coverage region…
Q: What is PCI slot? How is different from PCI Express (PCI-E)?
A:
Q: You can read on Crunchbase that BlaBlacar, “is a long-distance carpooling platform that connects…
A: Answer : digital entrepreneurship is a correct answer.
Q: Q6. In the diagram below, R1, R2 and R3 are three routers. How many local area networks (LANS) do…
A: only one question i can slove plz ask another questions 7 , 8 and 9 in part wise sloution;
Q: For the implementation of stack s using an array as the underlying data structure, after each…
A: Stack is a linear data structure that follows the principle of Last In First Out (LIFO). The last…
Q: What are VRAM and SGRAM?
A:
Q: Please do it Yourself. You are supposed to write an SRS document of the system scenario given in the…
A: ANSWER: INDEX OF THE CONTENTS • Introduction to the lab. • (Details of H/w & S/w to be used in…
Q: Discuss about entity Human based on following factor II) Attention III) Psychology iv) Ergonomics.
A: Ii)Attention is the ability to actively process the specific data or information in the environment…
Q: Write a program to satisfy the requirements in Starting Out with C++ Chapter 4 #12 Programming…
A: ANSWER:-
Q: Write the following SQL Statements: Write a SELECT statement that returns one row for each customer…
A: Answer: We have written SQL command and our guidelines is answer the first three question from the…
Q: My interest results keeps coming out to 0.00? Not sure what I'm doing wrong
A: You have typed the wrong formula in your terminal. Kindly copy paste the code as it is to get the…
Q: Compute the least common multiple (LCM) of 700 and 1890 using transform and conquer.
A: solution
Q: BMI Below 18.5 18.5-24.9 25.0-29.9 30.0-34.9 35.0-39.9 Above 40 Weight status Underweight Normal…
A: # Write a program that accepts a users height as an integer in inches and their weight in…
Q: How do you compute the union, intersection, and difference of two sets, using just the methods of…
A: Please find the answer below :
Q: What will the foll def foo(a, b): print(a-b) def main(): a=5 b=2 foo(b.a)
A: Dear Student, When foo function is called with values b=2 and a = 5, b-a will be calculated ie 2-5 =…
Q: A tecnician is troubleshooting a PC with mutiple volumes. to verify which are active and assigned…
A: Here in this question we have asked that a tecnician is troubleshooting a PC with mutiple volumes.…
Q: Need to fill the blanks. #include #include #include // this library is needed to use exit(0) //…
A: Fill in the blanks. Note: The solution provided is in bold.
Q: write the following iptables on the server to block the following traffic types originated from the…
A: QUESTION 1 Ans: iptables -I INPUT -s <attacker's IP address> -p tcp --dport 80 -j…
Write a function named file_sum that takes as a parameter the name of a text file that contains a list of numbers, one to a line, like this:
The function should sum the values in the file and write the sum (just that number) to a text file named sum.txt.
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 2 images
- Question 55 Write a function that takes two parameters, a file name to create and an integer. The function should write all the even numbers between 0 and the integer to the file name passed in. The numbers should be all on one line of the file For example: write_evens("even_file.txt",20) This should create a file called even_file.txt that contains 0 2 4 6 8 10 12 14 16 18 20 Full explain this question and text typing work only thanksWrite a function named file_stats that takes one string parameter (in_file) that is the name of an existing text file. The function file_stats should calculate three statistics about in_file: the number of lines it contains, the number of words and the number of characters, and print the three statistics on separate lines. For example, the following would be the correct input and output:>>> file_stats('created_equal.txt')lines 2words 13characters 72Note: The number of characters may vary slightly between operating systems. Similarly, the number of lines may vary by 1 line, depending on the method used to calculate it.Write a function named repeat_words that takes two string parameters: 1. in_file: the name of an input file that exists before repeat_words is called 2. out_file: the name of an output file that repeat_words creates Assume that the input file is in the current working directory and write the output file to that directory. For each line of the input file, the function repeat_words should write to the output file all of the words that appear more than once on that line. Each word should be lower cased and stripped of leading and trailing punctuation. Each repeated word on a line should be written to the corresponding line of the output file only once, regardless of the number of times the word is repeated. For example, if the following is the content of the file catInTheHat.txt: Too wet to go out and too cold to play ball. So we sat in the house. We did nothing at all. So all we could do was to Sit! Sit! Sit! Sit! The following function call: inF = 'catInTheHat.txt' outF =…
- Define a function named get_freq_of_e_ending_words (filename) that takes a filename as a parameter. The function reads the contents of the file specified in the parameter and returns the number of words which end with the letter 'e'. Note: remember to close the file properly. Note: you can assume that a word is considered to be any sequence of characters separated with white-space and the file is a plain text file that contains 1 or more words. For example: Test Result print (get_freq_of_e_ending_words ('summer.txt')) 15In Python Write a program that consists of (at least) two function: A function that creates and saves data in a file. The saved data represents exam grades. In the function, you will create n random numbers in the range [0,100], where n is the number of students. The function can be called as follows: createFile(filename, n) Main function, in which the user inputs the file name and the number of students, then the main calls function createFile. The main should perform validation for n (should be > 0), and the filename (should end with .txt). I will explain how to validate strings in the coming lecture. Hint: a good developer will write four functions to solve the problem.Write a function that reads a single line of numbers from a file named "question1.txt", and returns the average of the numbers read. For example, if the file is as follows: question1.txt 1 3 5 -2 4 0 6 -2 -3 then the function must return 12/9 = 1.33333 def file_average()= in python
- in python. Write a function named file_sum that takes as a parameter the name of a text file that contains a list of numbers, one to a line, like this: 23.77 116 94 -12.8 0 14.999 The function should sum the values in the file and write the sum (just that number) to a text file named sum.txt.Write a write_scores function that opens the file, and writes scores and names from lst_scores and lst_names into the file. An example function call is below. Make sure to handle a file error. Assume good input in both lists. Function name: write_scoresParameters: lst_scores, a list of ints; lst_names, a list of strings; file_name, a string Purpose: Writes the names and scores to the file name, with one name and one corresponding score per line.Example function call: (attached) After this code runs, the file final_grades.txt should read: Ayesha 96 Paolo 99 Ahmed 93 Anna 94Python - Next Birthdate In this task, we will write a program that reads birthdate data from a given CSV file, and given the current date, determines which person's birthday will be celebrated next. Create a function with the following signature: nextBirthdate(filename, date) filename: parameter, which represents the CSV filename. date: parameter, which represents the current date. The function should open the CSV file, read the birthdate data, and determine which person's birthday will be celebrated next, given the current date. The name of the person should be returned. In other words, given a date, find the person whose birthday is next. Sample Run birthdates.csv Draven Brock, 01/21/1952 Easton Mclean, 09/02/1954 Destiny Pacheco, 10/10/1958 Ariella Wood, 12/20/1961 Keely Sanders, 08/03/1985 Bryan Sloan,04/06/1986 Shannon Brewer, 05/11/1986 Julianne Farrell,01/29/2000 Makhi Weeks, 03/20/2000 Lucian Fields, 08/02/2018 Function Call nextBirthdate("birthdates.csv", "01/01/2022") Output…
- Coding Problem: GetGrade.py 1 #Write a function called get_grade that will read a 2 #given .en1301 file and return the student's grade. 3 #To do this, we would recommend you first pass the 4 #filename to your previously-written reader() function, 5 #then use the list that it returns to do your 6 #calculations. You may assume the file is well-formed. 7 # 8 #A student's grade should be 100 times the sum of each 9 #individual assignment's grade divided by its total, 10 #multiplied by its weight. So, if the .cs1301 just had 11 #these two lines: 12 # 13 #1 exam 1 80 100 0.6 14 # 2 exam 2 30 50 0.4 15 # 16 #Then the result would be 72: 17 # (Advanced) (External resourc 18 (80/100) 0.6+ (30/50) 0.4-0.72 100 - 72 19 20 21 write your function here! 22 23 24 25 #Below are some lines of code that will test your function. 26 #You can change the value of the variable(s) to test your 27 #function with different inputs. 1234 28 # 29 #If your function works correctly, this will originally 30 #print:…Design a program that reads a file called sales.txt containing the following data: Jane, 215.5,445.5,910.0 John, 825.0,250.5,675.0 Bill,0.0,999.15 Each line has a employee's name and their weekly sales totals all separated by commas. Some employees have taken vacation some weeks so no numbers are captured for those weeks. Create a function that takes a list of floats and returns the average value for those numbers. After reading the information from the file, use a for loop to calculate the sales average using your new average function for each employee and display the following output to the screen. Jane, average sales: 523.67 John, average sales: 583.50 Bill, average sales: 499.56Write the code segments based on the given descriptions: Declare a file pointer called input. Open a file called location.txt for reading using this pointer. If the file is not available, display “File does not exist.”. The content of the text file location.txt is as shown below. It includes the location, latitude and longitude values. FILE location.txt CONTENTS <Location> <Latitude> <Longitude> UTM 1.5523763 103.63322 KLCC 3.153889 101.71333 UM 3.1185 101.665 UMS 6.0367 116.1186 UNIMAS 1.465174 110.4270601 Ask the user to enter a location. Check if the user’s location can be found in the text file. If found, display the location, latitude and longitude as shown below. SAMPLE OUTPUT Enter a location: UM Location : UM Latitude : 3.1185 Longitude : 101.6650 Otherwise display “Sorry, location could not be found”. SAMPLE OUTPUT Enter a location : MMU Sorry, location could not be found