Write a program named filereader.py that reads and displays the data in friends.txt. This program should also determine and print the average age of the friends on file. That will require an accumulator and a counter. Use a while loop to process the file, print the data, and modify the accumulator and counter. Then close the file and display the average age accurate to one decimal place. SAMPLE OUTPUT My friend Denny is 24 My friend Penny is 28 My friend Lenny is 20 My friend Jenny is 24 Average age of friends is 24.0
Q: 1. Write a program in python with no imports named filemaker.py that will be used to store the first…
A: The name of the program is filereader.pyOpen the file named friends.txtUse a variable named…
Q: Write a program that allows the user to enter name and phone number. Have the program accept input…
A: Since you have not mentioned the programming language. I am attempting this in python. if you need…
Q: Write a program in a script file that finds the smallest odd integer that is divisible by 11 and…
A: here in the given question ask for a program,
Q: Create a program that reads three lines from a text file. Each line should be read one at a time.…
A: Please upvote/Like me. please. I am providing you the correct answer below. Please. Please.
Q: Write a program that finds the number of times a specific word appears in a text file. The program…
A: we have to write c++ programme for this.
Q: Write a program that prompts the user to enter a decimal number that has two-digits decimal part and…
A: The code is done in C++ programming language. The code and output is given below
Q: Create a simple java program that reads all the content in a .txt file, the user will enter the…
A: Answer:
Q: an input file stream called "Numbers.txt" and print prime numbers to an output file stream called…
A: the code for the above requirement is
Q: Write a program that reads from an input file, given by a user, students grade information after a…
A: Provide API documentation comments for your class(es), class constructor(s) and method(s) using the…
Q: PYTHON PROGRAM Write a program that will ask a user to input a word and that will check if…
A: Take user input Check if it's a palindrome word or not if YES: Save the word in Palindromes.txt file…
Q: What is wrong with the following code snippet that is supposed to print the contents of the file…
A: Answer :b- A run-time error occurs because the file does not exist
Q: • Write a program that computes and prints the average of the numbers in a text file. • You should…
A: Define the main function which will include the following things prompt user for input of text…
Q: in python 2. Now write a program named filereader.py that reads and displays the data in…
A: The following python program is created that reads and displays data in a file named as friends.txt…
Q: A program reads the data from a file called inputFile.dat and, after doing some calculations, writes…
A: Answer: a. The contents of the file inputFile.dat after the program executes are remain the same as…
Q: Assume that a file containing a series of integers is named numbers.txt . Write a program that…
A: GIven: Assume that a file containing a series of integers is named numbers.txt . Write a program…
Q: 2. Write a program that asks the user for the name of a file. The program should read all numbers…
A: #asking user to enter file namefileName = input('Enter filename:')file = open(fileName, 'r')#opening…
Q: Write a program to copy an existing text file from your hard disk to another file that you will…
A: fstream - This is a stream class that performs operations on input and output files, to read and…
Q: Given the following lines of code, write a loop to read in the file line by line: String line; int…
A: Given: Fill in the blanks.
Q: Let (money.txt) be a text file that contains amounts of money spent on fast food for a given number…
A: Given data, Let (money.txt) be a text file that contains amounts of money spent on fast food for a…
Q: Write a program that finds the number of times a specific word appears in a text file. The program…
A: The complete C++ code is given below with Output screenshots F1.txt file is used for the code…
Q: Problem Write a program that reads a comma delimited CSV file with four columns and returns the…
A: Required: Problem Write a program that reads a comma delimited CSV file with four columns and…
Q: Write a program to help a local stock trading company automate its systems. The company invests only…
A: Actually program is a executable software that runs on a computer.
Q: If this pyramid has a 2 meters high secret room, then the total number of stones needed is 56 – 4 =…
A: Here is the C++ Program: #include<bits/stdc++.h>using namespace std;int main(){…
Q: A teacher has asked all her students to line up single file according to their first name. For…
A: Given: A teacher has asked all her students to line up single file according to their first name. For…
Q: I am trying to write a program in PYTHON that will open a file named StudyHours.txt. The program…
A: Code: #step variable to iterate every third step of filestep = 3#open file StudyHours.txt in read…
Q: In Python, which of the following opens read_it.txt for reading in data text_file varible. a.…
A: 1) In python we use built-in open() function to open the file The open() function returns a file…
Q: Write a program that displays the cost of different options at a vending machine. Your program must,…
A: Open the file and read the file character by character and write respective price to another file
Q: Write a program that uses a text file to store weekly payroll data for the office. The program…
A: Program plan: Firstly creating a main() function Giving a name to the file for the program Opening…
Q: the number of times each word appears in the file
A: As programming language is not mentioned. So, used Python Programming language to complete the task.…
Q: can you plz write it in util.scanner Read a multi-line text file. Count the characters in each…
A: We need to write a Java program that reads an input file characters line by line and prints the…
Q: Write a program to read in numbers, round them and then total their value. Input will be from a data…
A: The C++ code is given below with output screenshots Contents of the file is also given for your…
Q: SAMPLE OUTPUT My friend Denny is 24 My friend Penny is 28 My friend Lenny is 20 My friend Jenny is…
A: INPUT:Denny 24Penny 28Lenny 20Jenny 24 OUTPUT:
Q: Write a program that displays the cost of different options at a vending machine. Your program must:…
A: ifstream is a stream used for file reading ofstream is a stream used for file writing
Q: Using only Unix system calls(like open, seek(), tell, etc.), write a C program to reverse the order…
A: Program #include <stdio.h>#include <stdlib.h>#include <string.h> void…
Q: Write a program named filemaker.py that will be used to store the first name and age of some friends…
A: Program Plan: Create a file friends .txt and allow your system to access that file. open the file…
Q: Write a complete java program that: asks the user for a filename tests whether the file exists and…
A: Given data, Write a complete java program that: asks the user for a filename tests whether the file…
Q: Write a program that finds the number of times a specific word appears in a text file. The program…
A: #include <iostream>#include <fstream>using namespace std;bool iequals(const string&…
Q: Write a program that open a text file "hello.txt" in reading mode and display the contents of that…
A: Objective: This program reads a file naming "hello.txt" and shows its content. It would open the…
Q: Exercise 7: Name your program Lab12_ex1_Id.py Write a Python program that reads each line of an…
A:
Q: Write Java program(s) to do the following: 1) Write the data from books.txt as a Serialized file…
A: solution :As the specification given in the question , required java code will be…
Q: Can you please help solve this, please as fast as possible 6.20: Word Count (see attached screen…
A: The approach and a C program to prompt a user to input the name of a text file and then count the…
Q: Write a program which randomly rolls a die 100 times (results in one of the six sides). Use the…
A: Hi. Let's move on to the code in the next step. I have included comments in the code that will help…
Q: Write a complete program that does the following: Opens an output file with the filename…
A: Algorithm: Step 1: declare file pointer; step2: open file step3:traverse for loop from 0 to 100 and…
Q: Create a simple java program that reads all the content in a .txt file, the user will enter the…
A: The code is given below.
Q: write a program that printout the last modified of the filename etc/passwd using stat(filename,pbuf)
A: Start Take the file as input Find the last modified date and time. Then print the last modified…
Q: Create a program to count the word's length distribution of a text file. The program should read in…
A: Below i have coded:
Q: Write a program that allows the user to enter name and phone number. Have the program accept input…
A: Hey, since multiple questions posted, we will answer first question according to our policy. If you…
Q: Write a program that reads from an input file, given by a user, students grade information after a…
A: Solution: Provide API documentation comments for your class(es), class constructor(s) and…
Write a program named filereader.py that reads and displays the data in friends.txt. This program should also determine and print the average age of the friends on file. That will require an accumulator and a counter. Use a while loop to process the file, print the data, and modify the accumulator and counter. Then close the file and display the average age accurate to one decimal place.
SAMPLE OUTPUT
My friend Denny is 24
My friend Penny is 28
My friend Lenny is 20
My friend Jenny is 24
Average age of friends is 24.0
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 2 images
- A program reads the data from a file called inputFile.dat and, after doing some calculations, writes the results to a file called outFile.dat. Answer the following questions:a. After the program executes, what are the contents of the file inputFile.dat?b. After the program executes, what are the contents of the file outFile.dat if this file was empty before the program executed?c. After the program executes, what are the contents of the file outFile. dat if this file contained 100 numbers before the program executed?d. What would happen if the file outFile.dat did not exist before the program executed?Create a program that calculates the average test scores. Given the student’s name and five test scores, calculate the test scores. The student’s name, five test scores and the average test score is stored in the file testaverage.txt. The data is input from the file test.txt. Sample Run Input file (Contents of the file test.txt) Andrew Miller 87.50 89 65.75 37 98.5 Output file (Contents of the testaverage.txt) Student Name: Andrew Miller Test Scores: 87.50 89.00 65.75 37.00 98.50 Average test score: 75.75In pthon, how can I fix this code so that it changes the word 'language' in the file to test below where the user inputs info? ile=input('Enter a file name : ')string1=input('Enter a string to be replaced : ')string2=input('Enter a string to be added : ')with open(file,'r') as f: data=f.read()data=data.replace(string1,string2)with open(file,'w') as f: f.write(data)f = open(file, "r")print(f.read()) the file is called Problem 2.txt and contains the following text: Python language is incredibly easy to use and learnfor new beginners and newcomers. The python languageis one of the most accessible programming languagesavailable because it has simplified syntax and notcomplicated, which gives more emphasis on naturallanguage. Due to its ease of learning and usage,python codes can be easily written and executed muchfaster than other programming languages. right now, the text just displays: Enter a file name : problem 2.txtEnter a string to be replaced : languageEnter a string…
- Write a program that prompts the user to enter the name ofan author and the title of one their books. It writes the author’s name to a file.Their book’s titleis written at the end of a file Books.txt with the line number of the author’sname in Authors.txt inserted before the title. Assume that the title is notalready stored in Books.txt and the author name is already in Authors.txt.Write a program that reads a student's name followed by five test scores. The program should output the student's name, the five test scores, and the average test score. Output the average test score with two decimal places. The data to be read is stored in a file called test.txt. The output should be stored in a file called testavg.txt. test.txt: A file containing the student names and the five test scores for every student. Andrew Miller 87.50 89 65.75 37 98.50 Green Sheila 91.05 75.88 50.0 65.5 74.30 Sethi Amit 49.82 75 30 74 86.30 testavg.txt: A file containing the student name, the five test scores, and the average of the five test scores for each student.in python 2. Now write a program named filereader.py that reads and displays the data in friends.txt. This program should also determine and print the average age of the friends on file. That will require an accumulator and a counter. Use a while loop to process the file, print the data, and modify the accumulator and counter. Then close the file and display the average age accurate to one decimal place. See the Sample Output..SAMPLE OUTPUT My friend Denny is 24My friend Penny is 28My friend Lenny is 20My friend Jenny is 24Average age of friends is 24.0
- 2. Now write a program named filereader.py that reads and displays the data in friends.txt. This program should also determine and print the average age of the friends on file. That will require an accumulator and a counter. Use a while loop to process the file, print the data, and modify the accumulator and counter. Then close the file and use an f-string display the average age accurate to one decimal place. See the Sample Output..SAMPLE OUTPUT My friend Denny is 24My friend Penny is 28My friend Lenny is 20My friend Jenny is 24Average age of friends is 24.0Write a program named filemaker.py that will be used to store the first name and age of some friends in a text file named friends.txt. The program must use a while loop that prompts the user to enter the first name and age of each friend. Each of these entries should be written to its own line in the text file (2 lines of data per friend). The while loop should repeat until the user presses Enter for the name. Then, the file should be closed and a message should be displayed. SAMPLE OUTPUT Enter first name of friend or Enter to quit DennyEnter age (integer) of this friend 24Enter first name of friend or Enter to quit PennyEnter age (integer) of this friend 28Enter first name of friend or Enter to quit LennyEnter age (integer) of this friend 20Enter first name of friend or Enter to quit JennyEnter age (integer) of this friend 24Enter first name of friend or Enter to quitFile was createdI just need program6_2.py solved program6_1.pyWrite a program named program6_1.py that prompts the user to enter six test names and their scores and writes them to a text file named tests.txt. You must use a loop. Each input should be written to its own line in the file. The program should generate a confirmation message when done. See SAMPLE OUTPUT. SAMPLE OUTPUTEntering six tests and scores Enter test name objects Enter % score on this test 88 Enter test name loops Enter % score on this test 95 Enter test name selections Enter % score on this test 86 Enter test name variables Enter % score on this test 82 Enter test name files Enter % score on this test 100 Enter test name functions Enter % score on this test 80 File was created successfully program6_2.pyWrite another program named program6_2.py that uses a loop to read and process tests.txt from program6_1.py. The program must output a two-column table (see SAMPLE OUTPUT) showing the test names and scores. When the table is…
- Write a program that reads student data from a file, compute their GPA and writes the results to a different file. 1. The user should have the option to either enter their text file that contains the student grades or use the provided text file that contains theinformation. The data in "indata.txt" should look similar to this, Lara_Croft75 70 91 69 89Chris_Redfield68 88 79 85 94Johnny_Cochran69 98 95 77 80Wanda_Maximoff84 86 98 95 92Luke_Skywalker74 96 80 98 97William_Kurt89 52 99 81 58Samuel_Jackson50 96 50 64 95END_OF_FILE This is supposed to be in python. This is what I have so far. I have no experience I apologise. I am trying to finish the GPA calculating program currently but am having trouble finishing it. grade = input("enter grades")points = 0 if grade is 90-99:total_points = 4.0if grade is 80-89:total_points = 3.0if grade is 70-79:total_points = 2.0if grade is 60-69:total_points = 1.0if grade is 50-59:total_points = 0.0gpa = total_points/len(grade)print(gpa,"is gpa")The iostream library provides mechanisms for error handling, such as the failbit, badbit, and eofbit. However, if these are not checked after an input/output operation, it can lead to incorrect program behavior. For example, if you attempt to read past the end of a file without checking eofbit, the program may enter an infinite loop. *Can you provide a simple program of the above paragraph? How do you correct this vunerability?*Write a program that reads data from a file specified by the user at runtime (i.e. your program should accept the filename as user input) and stores the output in the file Ch3_Ex5Output.dat. To test your program, use the Ch3_Ex5Data.txt file.