Write a Python program that reads each line of an input file called data.txt that consists of a keyword followed by a sequence of numbers separated by commas. If the keyword is UP, the numbers are sorted in increasing order, if the key word is DOWN; the numbers are sorted in decreasing order. The sorted sequence of numbers is saved in sorted.txt. For example, if the data.txt contains UP 25 35 30 40 30 DOWN 20 30 25 25 DOWN 35 45 40 15 16 18 The file sorted.txt will contain 25 30 30 35 40 30 25 25 20 45 40 35 18 16 15
Q: Write a C++ program that reads a list of real numbers from an input file called numbers.dat then…
A: Solution : The required code which can perform the given task is as follows. Separatefloat.cpp…
Q: Write a program that reads every line in a text file, removes the first wordfrom each line, and then…
A: Given: Write a program that reads every line in a text file, removes the first wordfrom each line,…
Q: Write a Python program that reads from each line of an input file called grades.txt, a student id…
A: Actually, python is a easiest programming language. It is a dynamically typed language.
Q: Write a Python program that reads each line of an input file temperatures.txt that consists of a…
A: Hey there, I am writing the required solution based on the above given question. Please do find the…
Q: Write a program called ReverseText.exe that takes two file names as command-line arguments. The…
A: In this C program, I have created a function that will read the first file and append the content…
Q: write a program that will open a file called “story.txt” and count the number of occurrences of each…
A: EXPLANATION: Used system call fopen,we have opened the file "file1.txt"in read mode System call…
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: 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 prompts the user for an input file name, reads all words from the input file,…
A: ALGORITHM:- 1. Take input for file name from user. 2. Read the data from it. 3. Write that data into…
Q: Write a program that reads a text file named as "input.txt" and performs the following operations:…
A: /* C program that write each word in a text file in a reverse order and performs all the given…
Q: Write a program that reads in two hexadecimal numbers from a file, hex.txt, and prints out the sum…
A: Here, I'm writing C++ code:- #include<iostream>#include <fstream>using namespace…
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 program which reads from a file all digits and prints the largest number which is a multiple…
A: Include header files In main() declare the variables arr, count, largest , n, and line Create a…
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 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 that reads from each line of an input file called grades.txt, a student id…
A: Python code for Take three subject marks Return average with name or roll number.
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 in two hexadecimal numbers from a file, hex.txt, and prints out the sum…
A: #include<iostream>#include <fstream>using namespace std;bool…
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 program that receives a coded message file(Lab3ExtraCreditCT.txt) from your local espionage…
A: Programming is a way to instruct the computer devices to operate. Every computer needs a set of…
Q: Write an address book program that stores your contacts' names and their email addresses. The names…
A: Answer: I have done in python programming language. and also i have attached code as well as code…
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 program with python that asks the user to enter two filenames. One file contains a list of…
A: Note: Follow proper indentation as specified in the code snapshot while implementing code. Random…
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 program that reads the scores from numbers.txt a line at a time and displays their total and…
A: We will read from the file and loop till end of file and have a counter to count no of elements then…
Q: Write a program that reads in from a file a starting month name, an ending month name, and then the…
A: #include <iostream>#include <string>#include <fstream>#include…
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 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 uses 3 command line arguments to search a list of float numbers in a file and…
A: Here's the code for this in C++ (as no specific language is mentioned):
Q: Write a program that reads a text file named as “input.txt” and performs the following operations:…
A: while (ptr != NULL) { //Starting with Capital Letter if (ptr[0] >= 'A'…
Q: Write a Python program that reads each line of an input file temperatures.txt that consists of a…
A: inputfile=open('temperatures.txt','r') #Opening the temperatures.txt…
Q: Write a program that prompts the user for an input file name, reads all words from the input file,…
A: Create a objects of input and output file. Then read input file name Then open input file using…
Q: Write a program that will sequentially list numbers from 0 to 50, changing its color depending on…
A: Step 1 : Start Step 2 : Define a function delay() to print the numbers in an interval of 1 second.…
Q: Write a program that takes its input from a binary file of numbers of type double and outputs the…
A: import java.io.*; public classMain { public static void main(String args[])…
Q: Write a program that reads in two hexadecimal numbers from a file, hex.txt, and prints out the sum…
A: //USAGE hexdump.py [filename] import sys import os.path def check_file_provided(): # This method…
Q: Write a program that will read names, ids, dept names, and cgpa of some students from a file and…
A:
Q: Write a python program that reads the first n lines of a text file. Suppose you have a file with all…
A: Here, Code instruction is given.
Q: Write a python program that uses a dictionary to assign “codes” to each letter of the alphabet. For…
A: The, code has given below:
Q: Write a program that reads in two hexadecimal numbers from a file, hex.txt, and prints out the sum…
A:
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: Write a program called ReverseText.exe that takes two file names as command-line arguments. The…
A: In this C program, I have created a function that will read the first file and append the content…
Q: Write a program that reads in two hexadecimal numbers from a file, hex.txt, and prints out the sum…
A: Given data is shown below:
Q: Write a python program that reads from a text file whose name is provided by the user and including…
A: Explanation:
Q: Write a program to do the following: - 1) Read the file Mydata.txt which includes unlimited number…
A:
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 2 images
- reads in a file of student academic credit data. Each line of the input filewill contain the student name (a single String with no spaces), the number of semester hours earned (an integer),the total quality points earned (a double).Here is the students.dat data file:students.dat Smith 27 83.7Jones 21 28.35Walker 96 182.4Doe 60 150Wood 100 400Street 33 57.4Taylor 83 190Davis 110 198Smart 75 292.5Bird 84 168Summers 52 83.2 My question is how can I create the <<students.dat>> I already have the code but I just need help to create the students.datWrite a program in Python that reads student information from a text file, then creates a text file that records the course grades of the students and a final grade. Each row of the .txt file contains the Last Name, First Name, Midterm1 score, Midterm2 score, and the Final score of a student, each separated by a space. A sample of the student information is provided in StudentInfo.txt below. 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 .txt file from the user. • Open the .txt file and read the student information using readline() or readlines(). • 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 • Output the first names, last names, exam scores, and letter grades of the students into a text file named…Java Your program must read a file called personin.txt. Each line of the file will be a person's name, the time they arrived at the professor's office, and the amount of time they want to meet with the professor. These entries will be sorted by the time the person arrived. Your program must then print out a schedule for the day, printing each person's arrival, and printing when each person goes in to meet with the professor. You need to print the events in order of the time they happen. In other words, your output will be sorted by the arrival times and the times the person goes into the professor's office. In your output you need to print out a schedule. In the schedule, new students go to the end of the line. Whenever the professor is free, the professor will either meet with the first person in line, or meet with the first person in line if nobody is waiting. Assume no two people arrive at the same time. You should solve this problem using a stack and a queue. You can only…
- In Java Write a program that reads the student information from a tab separated values (tsv) file and creates a text file that contains student information together with 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: A: 90 =< x B: 80 =< x < 90 C: 70 =< x < 80 D: 60 =< x < 70 F: x < 60 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 and separate the values with a tab character. Ex: If the input of the program is: StudentInfo.tsv and the contents of StudentInfo.tsv are: Barrett Edan 70 45 59 Bradshaw Reagan 96 97 88 Charlton Caius 73 94 80 Mayo Tyrese 88 61 36 Stern Brenda 90 86 45…Python Write a program that first reads in the name of an input file and then reads the file using the csv.reader() method. The file contains a list of words separated by commas. Your program should output the words and their frequencies (the number of times each word appears in the file) without any duplicates. Ex: If the input is: input1.csv and the contents of input1.csv are: hello,cat,man,hey,dog,boy,Hello,man,cat,woman,dog,Cat,hey,boy the output is: hello 1 cat 2 man 2 hey 2 dog 2 boy 2 Hello 1 woman 1 Cat 1 my code is not working, this is what i have: import csv # to store wordswords= []# openfilewith open('input1.csv') as f:for row in csv.reader(f, delimiter=','):# read data, add to wordswords += row # get unique words unique_words = sorted(set(words), key=words.index) for word in unique_words : # print words followed by space then its countprint(word , words.count(word), end =" ") # formatted output at endprint("")In Python IDLE Write a program that reads the file’s contents and determines the following: The number of uppercase letters in the file The number of lowercase letters in the file The number of digits in the file The number of whitespace characters in the file Then the program should do a mass replacement of all spaces with a ‘-‘, and then replace any uppercase letters with lowercase letters. After the replacement of the spaces, the count of letters, digits, and spaces should be rerun, the number of replacements indicated, and a second report of letters, digits and spaces should be printed. Save the results of the changes in a file named “testoutput.txt”. This file must be submitted as part of the submission for your lab. Output should look like this: Uppercase letters: 20 Lowercase letters: 310 Digits: 4 Spaces: 82 >>> Hint: This program does not need to use any lists – the entire file can be read into one string. Problem 2. Date Printer - Write a program…
- The program takes a single argument as the name of the file to be read. A sample file is named (Movies.txt). The program reads this file which has labeled columns separated by commas. Every row of this text file includes information about a movie. You are asked to read every row as a string and decompose the given information (separated by commas). If a costumer wants too see "List of the Genres" (or genre,score,year) all genres type must be show. I need this answer in C language. Please explain nicely. Thanks.Write a program that receives a filename as user input. The file is structured as multiple lines containing numbers separated by a single space.For example, this would be an acceptable file: 1 2 3 4 5 6 7 2 Your program should open this file and: print all its contents; write the median of all numbers to a new file called result.txt. IMPORTANT NOTES: the median is the element in the middle when you sort the values; the median of values (2, 1, 3) is 2, because when you sort them, you get 1, 2, 3, and 2 is the value in the middle. you can assume there will be no empty lines; there might be any arbitrary number lines in the file; there might be any arbitrary number of elements in a single line; you can assume there will always be an odd number of elements. Example 1: If input is: file1.txt and the contents of file1.txt are: 1 2 2 you should first print the content, and then write 2 to result.txt. Example 2: If input is: file2.txt and the contents of file2.txt are: 1 2 3 4 5 1 7 you…In python please Lab: Faculty Salaries 1. Create a data file, called salary.txt, with 100 lines. 2. Each line in the file consists of a faculty:a. First nameb. Last namec. Rankd. Salary 3. For the first and last name use:ith line FirstNamei and LastNamei 4. The rank is randomly generated as assistant, associate, and full. 5. The salary is randomly generated as a number with two digits after the decimal point. a. Assistant Professor 50,000 – 80,000b. Associate Professor 60,000 – 110,000c. Full Professor 75,000 – 130,000 6. Sample data:FirstName1 LastName1 assistant 59125.75 FirstName2 LastName2 full 112800.25...FirstName100 LastName100 associate 89355.23 7. Using salary.txt that you created, write a program to display the following: a. Total salary for assistant professor, associate professor, and full professor b. Average salary for each.
- Write a C++ program that reads first name and last name from two txt files, input1.txt and input2.txt respectively and stores them in two separate arrays. Then merges these two arrays into another txt file output.txt. Example: Intput1.txt: Markus Input2.txt: Stocker Output.txt: Markus StockerWrite a python program that prompts the user for their favorite basketball team. It should be able to read the list of teams provided below in a file called favorite_teams.txt and check if their team is in that file. Teams in the file:JazzBullsMavericksSpursIf the team is in the file let the user know that their team is in the list of favorites. If the team is not in the file, add the team to the end of the file. Also, let the user know that their team will be added to the file.Sample Run in File:What is your favorite NBA team? Jazz [Enter]Your team Jazz is in the listFile before and after run: JazzBullsMavericksSpurs Sample Run not in File:What is your favorite NBA team? Pelicans [Enter]Your team Pelicans is not in the list. It will be added.File before run: JazzBullsMavericksSpursFile after run:JazzBullsMavericksSpursPelicansWrite 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")