Write a Python program that reads from each line of an input file called grades.txt, a student id followed by the student grades in 3 exams. The program will then calculate the average of the student and save in a file called results.txt the student id followed by the calculated average. For example, if the grades.txt contains sii1 60 60 90 S222 89.5 90 89 S333 42 50 43 The file results.txt will contain sii1: 70.00 S222: 89.50 S333: 45.00
Q: Write a program that prompts the user for a file name, then reads that file (assuming that its…
A: Hello Student, hope you are doing well, I will be trying my best to explain and fulfill your query.…
Q: Write a python program that asks the user how many words they would like to write to a file, and…
A: A python program that asks the user how many words they would liketo write to a file, and then asks…
Q: Write a python program that reads from a text file whose name is provided by the user and including…
A: Required:
Q: Write a program that prompts the user for an input file name, reads all words from the input file,…
A: Program in C++: #include <iostream>#include <fstream>#include <cstdlib>#include…
Q: Write a Python program in a .py file that includes the following: Program reads, formats and prints…
A: Coded using Python 3.
Q: Write a Program that reads integers from a file called "input.dat" (Figure 1) that contains unknown…
A: As no programming language is mentioned, it is solved using basic C++
Q: Write a program that reads the student information from a comma separated values (csv) file. The…
A: Required:
Q: Write a C program that reads real numbers from a data file named "numbers.txt", one-by-one. For each…
A: C Program for above : #include <stdio.h> int main() { //file pointers FILE *file,…
Q: Write a program that inputs a text file. The program should print the unique words in the file in…
A: NOTE : As the question is not specific about the programming language to be used to write the code ,…
Q: Write a program that reads a file in.txt containing marks of 5 students. The program calculates the…
A: As no programming language is mentioned, it is solved using basic C++
Q: Write a program, sumofsquares.c, which reads values from the file sumofsquaresin.txt and com- putes…
A: According to the Question below the Solution: Output:
Q: Suppose you are given a text file named "Cars", in which each line of the file contains the model,…
A: Program :
Q: Write a program that reads the attached file called input.txt , and creates an output.txt file that…
A: Here I have opened 2 files, input.txt in read mode and output.txt in write mode. Next, I have read…
Q: Write a program that opens a text file called quiz.txt for reading. This file contains a single line…
A: Note: Programming language is missing in the question. So we will answer this program in C++. If you…
Q: Write a program that reads the contents of a file named text.txt and determines the following The…
A: #include <iostream> #include <fstream> using namespace std; int main() { ifstream…
Q: Write a program that generates 10 random doubles, all between 1 and 11, and writes them to a text…
A: In the first program – Create an object for a file. Take an array of double type. Open a file using…
Q: Write a complete python program with a main function that reads from a file called numbers.txt and…
A: The main objective of the python program,main.py is to read a file that contains the two numbers on…
Q: Write a program that reads a text file named as "input.txt" and performs the following operations:…
A: The ask is to write a C program to do the following: - read a file named input.txt - read the input…
Q: Write a computer program that calculates the bullet train’s constant rate of acceleration, given an…
A: Code: import java.io.File;import java.io.FileWriter;import java.io.IOException;import…
Q: Write a complete program that will write a file (named output.txt) that contains the integers from 1…
A: //Note not programming language is mentioned so i was used python f=open("output.txt","r")for i in…
Q: Write a python program that reads from a text file whose name is provided by the user (see a sample…
A: Program code: #input of filenamefilename = input("Enter input filename: ") try: # open the file in…
Q: Write a Python program that reads student-csv.py file and find each student average. For example,…
A: To create student-csv.py we need to shape the below data : - Joe;80;73;88;90;60;75;72…
Q: Write a Python program sentences.py that prompts for multiple sentences. The program should write…
A: Python Reverse each word in a sentence
Q: Write a program that reads a student's name followed by five test scores. The program should output…
A: The coding implementation is implemented in C++ language:
Q: Write a program that reads a file consisting of students’ test scores in the range 0–200.…
A: Step 1 I am using c++ programming language for to execute this program.
Q: Write a Python program that calculates the area and the circumferenceof a circle whose radius is…
A: Required: Write a Python program that calculates the area and the circumferenceof a circle whose…
Q: Write a complete lython program that prompts the user for his/her full name. Regardless of the user…
A: Please find the answer below :
Q: a. Write a program that prompts the user for a file name, then reads that file (assuming that its…
A: Note: This code should be rewritten instead of copying to the compiler otherwise it will throw a…
Q: Write a C program that reads real numbers from a data file named "numbers.txt", one-by-one. For each…
A: C program that reads real numbers from a data file and for each number the program checks whether…
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: Write a C program that reads real numbers from a data file named "numbers.txt", one-by-one. For each…
A: Required:
Q: Write a program that reads a file consisting of students’ test scores in the range 0–200. It should…
A: Your program is absolutely correct but there is small wrong in text document. Don't use commas in…
Q: Write a Python program that reads from the user the name of two files (an input file and an output…
A: code :-- # getting the input an output file name from user file_in = input('Enter input file name :…
Q: Write a Python program that reads each line of an input file workshop.txt that consists of a city…
A: Algorithm: Start Read workshop.txt file data Declare an empty string s Iterate through file content…
Q: Write a program in python language using basics that takes multiple student marks as input. If a…
A: Use an infinite loop to accept input from user and exit from loop if the user input marks is…
Q: Write a Python program that reads each line of an input file called data.txt that consists of a…
A: Algorithm: Start Read the content of data.txt file and store the content in data Open sorted.txt…
Q: Write a program that reads a file consisting of students' test scores in the range 0-200. It should…
A: Store the given scores in a text file and open a file in reading mode using the ifstream object.…
Q: Write a program that produces a bar chart showing the population growth of Prairieville, a small…
A: Code: #include <iostream>#include <iomanip>#include <fstream>using namespace…
Q: Python program to read a filename lines.py and displays the contents of the file with line number
A: Program: # Python version 3# the main functiondef main(): # define the content to write in the…
Q: Write a program that creates the file "LetterGrades.txt" filled with 1000 randomly generated letter…
A: import random def main(): #create variable for file name fileName = 'LetterGrades.txt'…
Q: PP 8.3 Write a program that creates a histogram that allows you to visually inspect the frequency…
A: Answer : CODE: import java.io.*; class Scratch { //main method public static void…
Q: Please complete with Python write a program that reads a file containing text. Read each line and…
A: ALGORITHM:- 1. Take input for the both the filenames from the user. 2. Read line by line the input…
Q: Write a Python program that reads from each line of an input file called grades.txt, a student id…
A: Algorithm : Step 1 : opening the grades.txt file in read mode. Step 2 : opening the results.txt…
Q: For this task you are asked to write a program that will open a file called "story.txt" and count…
A: EXPLANATION: Used system call fopen,we have opened the file "file1.txt"in read mode System call…
Q: Write a program that asks the user for a file containing a list of items to be completed and a name…
A: Please indent the code as shown in the screenshot below :
Q: Write a program that asks the user for the name of a text file, and then prints to the screen each…
A: PROGRAM: #Defining main() def main(): #Getting file name as input from the user fileName =…
Q: program that reads 5 integer numbers from a file"integer.txt",and store sum and average in…
A: Program: # python version 3import sysdef main(): # open the file read_file =…
Trending now
This is a popular solution!
Step by step
Solved in 2 steps
- Python Please! Create a program that will allow a user to do either of the following things: Get input from the user to write the following information to a file: Student name Assignment average grade Mid-term test grade Fi-nal project grade Fi-nal test grade Allow the user to search the file by student name and output a weighted average (15%, 25%, 25%, and 35%, respectively) based on the grades for that student in the file. The user should be able to choose either of the two options until they want to stop.In 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.PYTHON: Write a program that reads the student information from a tab separated values (tsv) file. The program then creates a text file that records the course grades of the students. Each row of the tsv file contains the Last Name, First Name, Midterm1 score, Midterm2 score, and the Final score of a student. A sample of the student information is provided in StudentInfo.tsv. Assume the number of students is at least 1 and at most 20. The program performs the following tasks: Read the file name of the tsv file from the user. Open the tsv file and read the student information. Compute the average exam score of each student. Assign a letter grade to each student based on the average exam score in the following scale: A: 90 =< x B: 80 =< x < 90 C: 70 =< x < 80 D: 60 =< x < 70 F: x < 60 Compute the average of each exam. Output the last names, first names, exam scores, and letter grades of the students into a text file named report.txt. Output one student per row…
- PLEASE COMMENT CODE In a python program, create a new file and call it “ tracking”. Write to it four lines each contains information about an order like this: 1-00654-021 Dell charger Toronto-WEST 99-49-ZAD011-76540-022 ASUS battery Milton-EAST 34-56-CBH561-09239-026 HP HD Scarborough-NORTH 12-98-AZC451-12349-029 Mac FD North York-LAWRENCE 34-49-ZWL01Add the file two more lines: 1-34567-055 Lenovo SSD Milton-ON 34-09-MT04 1-90432-091 Lenovo battery Oakville-ON 78-KL98 Define a function that searches for a brand (e.g. Dell, ASUS, etc.). Test the function in your program.Exercise 5: Write a python program that reads from a text file whose name is provided by the user (see a sample below) blood glucose readings recorded during the last week. Each line contains a certain number of blood glucose readings followed by the patient id. Your program should then display for each patient, their id number, the number of readings, the average value of the readings followed by the patient status (Normal range: 90–120 mg/dl, Low range: less than 90 mg/dl, High otherwise). Your program should consider the following erroneous cases and display appropriate message as shown in the sample output below: • The file does not open/exist • The readings are invalid (non-integer values or negative) or missing, in which case a ValueError exception should be raised and the processing should continue. Enter input filename: patients.txt Patient Id #Readings Average Status ========== ========= ======= ====== 120 150 150 P1111 P1111 3 140 High 100 90 90 100 P2222 P2222 4 95 Normal…Code should be in Python. A photographer is organizing a photo collection about the national parks in the US and would like to annotate the information about each of the photos into a separate set of files. Write a program that reads the name of a text file containing a list of photo file names. The program then reads the photo file names from the text file, replaces the "_photo.jpg" portion of the file names with "_info.txt", and outputs the modified file names. Assume the unchanged portion of the photo file names contains only letters and numbers, and the text file stores one photo file name per line. If the text file is empty, the program produces no output. (Examples in image)
- Using Python: program6_1.pyWrite a program that uses a text file to store weekly payroll data for the office. The program should enable the user to enter the name, hourly pay rate, and weekly hours for a number of office employees. The pay rate and hours should be type float, and each datum should be written to its own line in the file. Enter data for at least five employees and then close the file.Sample Output See image below program6_2.pyThis program reads the text file created in the program above and then calculates and prints each employee's weekly pay. Note the currency format with commas for thousands. The program should finish by printing the total payroll for the office.Sample Output see image belowPython - 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…The Directir file contains namés línhe employees and their phone numbers in the following order: Last name, First name, Phone. The creator of this file made several mistakes by typing commas and dots inconsistently. Write a Python program to read this file and produce an output file with the name DirectoryNew.txt. This file should format the phone directory as follows: Phone First name Number 1 First name 1 Number 2 First name 2 The file MUST end with: End of directory Edit Metadata Edit Metadata Content of the input file The output should be as follows Springsteen, Bruce, 2587. Hassan, Amir, 6958. Phone First name Homes, Rebecca, 5263 Smith, John, 5252 MacDonald, Mirna, 8965! Pichai, Sundar, 9632. Jobs, Steve, 1002 2587 Bruce 6958 Amir 5263 Rebecca 5252 John 8965 Mirna 9632 1002 Goldsmith, Micheal, 5478. Sundar Yassir, Ammar, 8885 Steve Nicholas, Jack, 4696 5478 Micheal 8885 Pang, Chee, 9898 Lee, Andrew, 7412. Jimenez, Dragos, 6547 Ammar 4696 Jack 9898 Chee 7412 Andrew 6547 Dragos…
- 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")Program a python program that demonstrates reading and comparing Create a python program that demonstrates reading and comparing multiple files, processes the input files based on the business rules, and produces an output file. Needed Files 1. The timeclock.txt Download timeclock.txtfile contains the hours worked data for every employee as well as the shift they worked. The layout for the file is as follows: EMPLOYEE_NUMBER, HOURS_WORKED, SHIFTTimeclock.txt 22476, 45, 3 24987, 30, 148283, 50, 285437, 25, 3 2. The personnel.txt Download personnel.txtfile contains the names of all employees and their hourly pay rates. The layout for the file is as follows: EMPLOYEE_NUMBER, EMPLOYEE_NAME, PAY_RATEPersonnel.txt 11235, Bob Smith, 10.50 22476, John Roberts, 12.3524987, Mary Johnson, 15.9032743, Brad Carson, 11.2548283, Alice Martin, 14.2085437, Aaron James,15.15 Note: Both the timeclock.txt and payroll.txt files are pre-sorted by EMPLOYEE_NUMBER in ascending order. Business…PYTHON!!!!! A file concordance tracks the unique words in a file and their frequencies. Write a program that displays a concordance for a file. The program should output the unique words and their frequencies in alphabetical order. Variations are to track sequences of two words and their frequencies, or n words and their frequencies. Below is an example file along with the program input and output: example.txt I AM SAM I AM SAM SAM I AM Enter the input file name: example.txt AM 3 I 3 SAM 3 The program should handle input files of varying length (lines). Program produces correct output given input, test 1 Test Case: Test program with example.txt Input: example.txt Results: AM 3 I 3 SAM 3 Program produces correct output given input, test 2 Test Case: Test program with test file 2 Input: test.txt Results: 3/4 1 98 1 AND 2 GUARANTEED 1 INDEED 1 PERCENT 1 SUCCEED 1 WILL 2 YES 1 YOU 2