Suppose you are given a text file that contains the names of people. Every name in the file consists of a first name and last name. Unfortunately, the programmer that created the file of names did not guarantee that each name was on a single line of the file. Read this file of names and write them to a new text file sorted according to first name, one name per line. For example, if the input file contains Ed Marston Bob Jones Jeff Williams Fred Charles The output file should be Bob Jones Ed Marston Fred Charles Jeff Williams Use arrays to solve the problem.
Q: Write a program that reads the-zen-of-python.txt and writes each line to UpdatedZen.txt, a new text…
A: import sys# files infile = Noneoutfile = Nonetry: # try to open infile =…
Q: Suppose you are given a text file named "input". The file includes 100 lines. Each line of the file-…
A: Based on Java
Q: In the game of scrabble, each letter is associated with a number of points. It is these points that…
A: Hey there, I am writing the required solution of the questin mentioned above. Please do find the…
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 first reads in the name of an input file and then reads the file using the…
A: import csv# to store wordswords= []# openfilewith open('input1.csv') as f: for row in…
Q: Write a program count.c that reads an existing ASCII text file, and prints on sere screen the number…
A: [C Program]#include <stdio.h>#include <stdlib.h> //main function with command line…
Q: xt file of names, (3 names per line, 5 lines in total) followed by an age for each name. Go through…
A: input.txt Smith 25 kevin 65 Hank 54Tom 98 Ben 96 Denver 63John 52 Gandia 63 Tokeyo 29Lebaon 36…
Q: Write a program that first reads in the name of an input file and then reads the file using the…
A: Given code: #Header file import csv #Getting the input file file = input() #Initializing frequency…
Q: Write a program that first reads in the name of an input file and then reads the file using the…
A: Here, Code instruction is given.
Q: Write a single program that: Obtains two separate text sentences from a user. Produce statistics on…
A: The code is written in the java programming language.
Q: You are provided with an input file ("Data.txt") containing a number of text lines. Each line…
A: Required: please use spyder
Q: Write a program that first reads in the name of an input file and then reads the file using the…
A: Step 1 : Start Step 2 : Import the csv module and declare the freq dictionary. Step 3 : Take user…
Q: Modify your program from Learning Journal Unit 7 to read dictionary items from a file and write the…
A: Answer is given below .
Q: Write a program that first reads in the name of an input file and then reads the input file using…
A: Here I have taken input from the user for the name of the file. Next, I have opened the file in read…
Q: Counting the character occurrences in a file For this task you are asked to write a program that…
A: Solve it in C language // use new method pls
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: You are required to implement a program which will read in a text file (.txt) containing words which…
A: Here we have given the program in c to implement a program which will read in a text file (.txt)…
Q: Below this question is a generated text representing a DNA sequence. The first line starts with '>'…
A: The algorithm steps to write the given function gcContent(sequence) are given below:- First, count…
Q: Write a program that first reads in the name of an input file and then reads the input file using…
A: PROGRAM: #Defining the readFile() function def readFile(file_Name): dictn = {} with…
Q: Please answer it in Python In the game of scrabble, each letter is associated with a number of…
A: Hey there, I am writing the required solution of the above stated question.Please do find the…
Q: Counting the character occurrences in a file For this task you are asked to write a program that…
A: Answer:
Q: Write a program that first reads in the name of an input file and then reads the file using the…
A: According to the Question below the solution: Output:
Q: Write a program in MIPS that does the following: Request the name of a file from the user and open…
A: Write a program in MIPS that does the following: Request the name of a file from the user and open…
Q: Counting the character occurrences in a file For this task you are asked to write a program that…
A: The logic behind the code is if the string starts with a then a = s[i] - 'a' becomes 0 and the…
Q: Modify the Total program so that it shows the average, not the total of the inputs. Total.java 1…
A: A modified “Total” program is as follows, File name: “Total.java” import java.io.File; import…
Q: xt contains a large number of English Language words, one per record. Write a program that uses this…
A: A file words.txt contains a large number of English Language words, one per record. Write a program…
Q: containing a list of photo file names. The program then reads the photo file names from the text…
A: Code: file = open("ParkPhotos.txt") for i in file: temp = i.strip().replace(…
Q: A photographer is organizing a photo collection about the national parks in the US and would like to…
A: Actually, program is an executable software that runs on a computer.
Q: Task 1 Write a python program that reads the first n lines of a text file. Suppose you have a file…
A: Assume that, already there is a with name test.txt is present which is an empty file. So, first in…
Q: Write a program that first reads in the name of an input file and then reads the file using the…
A: Write a program that first reads in the name of an input file and then reads the file using the…
Q: Write a program that reads two input files whose lines are ordered by a key data field. Your program…
A: required: Write a program that reads two input files whose lines are ordered by a key data field.…
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: 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: Write a program that first reads in the name of an input file and then reads the file using the…
A: CODE:- import csv n = input()with open(n, 'r') as myfile: Reader = csv.reader(myfile,…
Q: sum of the will have an orthogonal triangle input from a file and you need to find the max numbers…
A: Code : #function to check number is prime or nor def isPrime(num): flag = True if num > 1:…
Q: Write a program that will read a file from the user and writes its content in another file such that…
A: Given: inputfile = input('Enter filename to read: ') outputfile = input('Enter filename to write: ')…
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 first reads in the name of an input file and then reads the file using the…
A: Programming instructions: Import necessary header files. Take the file name from the user.…
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 program to read the names stored in three different files: file1.txt, file2.txt and…
A: Note: Since no programming language is mentioned. I am attempting this in python. if you need it in…
Q: Create a program that reads the file (create a paragraph in a file). It should analyze each…
A: Dear Student, The source code for the program is given below with proper indentation.…
Q: a random text file given as input in Python however, each line that you read and read transfers from…
A: # provide input file with text# read input file ip.txt in read modewith open("ip.txt", "r") as file:…
Q: Write a program that will input the contents of a text file containing integers then writes each…
A: CODE WITH OUTPUT:- SAMPLEINPUT.TXT = 1 3 4 3 2 5 6 4 2
Q: In Python A single output file named myoutput.txt is provided that is initially empty. Description…
A: Objective: This program reads an input file and checks if the lines are palindrome. The output for…
Q: Write a program that inputs a text file. The program should print the unique words in the file in…
A: First, we are taking an input file name from the user and then opens that file and reads each word,…
Q: Write a program that receives a filename as user input. The file is structured as multiple lines…
A: Note: - As the programming language is not mentioned to write the program so I am using python to…
Q: Write a program that first reads in the name of an input file and then reads the file using the…
A: Initially make Sure to save the file before executing as shown below: Executable Code: import csv #…
Q: I have managed to get my random number generator working. The range of the random number and how…
A: Please give positive ratings for my efforts. Thanks. PROGRAM import random #main function def…
Suppose you are given a text file that contains the names of people. Every name in the file consists of a first name and last name. Unfortunately, the programmer that created the file of names did not guarantee that each name was on a single line of the file. Read this file of names and write them to a new text file sorted according to first name, one name per line. For example, if the input file contains
Ed Marston Bob Jones Jeff Williams Fred Charles |
The output file should be
Bob Jones Ed Marston Fred Charles Jeff Williams |
Use arrays to solve the problem.
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 3 images
- 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")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 Note: There is a newline at the end of the output, and input1.csv is available to download. use "import csv" in code.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 Note: There is a newline at the end of the output, and input1.csv is available to download.
- 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 Note: There is a newline at the end of the output, and input1.csv is available to download. use "import csv" in code. **This code prints the output in a straight line aross and not down. import csv file = input() frequency = {} with open(file, 'r') as csvfile: csvfile = csv.reader(csvfile)for row in csvfile:for word in row:if word not in frequency.keys():frequency[word] = 1else:frequency[word] = frequency[word] + 1 for i in frequency.keys():print(i,"",frequency[i],end="\t\t")Write 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…Write a program 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…
- Please answer it in Python In the game of scrabble, each letter is associated with a number of points. It is these points that make it possible to calculate the score of each player at the end of the game. We would like our program to be able to choose, among the words we can play, the one with the highest total of points. To do this, we store the points corresponding to each letter in a text file called points.txt. Each line in this file contains a letter and its number of points, separated by spaces. Points.txt= https://tinyurl.com/pointtxt Download the points file.txt to your working directory. Write a function score_mot (points, word) that takes as an argument a dictionary matching each letter its number of points, and a word, and that returns the score. For example: What letters do you have in hand ? SALUT #return => Here's the best word you can play: SALUT for a score of: 5Please answer it in Python In the game of scrabble, each letter is associated with a number of points. It is these points that make it possible to calculate the score of each player at the end of the game. We would like our program to be able to choose, among the words we can play, the one with the highest total of points. To do this, we store the points corresponding to each letter in a text file called points.txt. Each line in this file contains a letter and its number of points, separated by spaces. Points.txt= https://tinyurl.com/pointstxt 1. Download the points file.txt to your working directory. 2. Write a function read_points() that reads the points file.txt and returns a dictionary that matches each letter to its number of dots (integer). 3. Write a function score_mot (points, word) that takes as an argument a dictionary matching each letter its number of points, and a word, and that returns the score. For example: What letters do you have in hand ? taslu #return => Here's…Write a program that first reads in the name of an input file and then reads the input file using the file.readlines() method. The input file contains an unsorted list of number of seasons followed by the corresponding TV show. Your program should put the contents of the input file into a dictionary where the number of seasons are the keys, and a list of TV shows are the values (since multiple shows could have the same number of seasons). Sort the dictionary by key (least to greatest) and output the results to a file named output_keys.txt. Separate multiple TV shows associated with the same key with a semicolon (;), ordering by appearance in the input file. Next, sort the dictionary by values (alphabetical order), and output the results to a file named output_titles.txt. Ex: If the input is: file1.txt and the contents of file1.txt are: 20 Gunsmoke 30 The Simpsons 10 Will & Grace 14 Dallas 20 Law & Order 12 Murder, She Wrote the file output_keys.txt should contain: 10: Will…
- Write a program that first reads in the name of an input file and then reads the input file using the file.readlines() method. The input file contains an unsorted list of number of seasons followed by the corresponding TV show. Your program should put the contents of the input file into a dictionary where the number of seasons are the keys, and a list of TV shows are the values (since multiple shows could have the same number of seasons). Sort the dictionary by key (least to greatest) and output the results to a file named output_keys.txt, separating multiple TV shows associated with the same key with a semicolon (;). Next, sort the dictionary by values (alphabetical order), and output the results to a file named output_titles.txt. Ex: If the input is: file1.txt and the contents of file1.txt are: 20 Gunsmoke 30 The Simpsons 10 Will & Grace 14 Dallas 20 Law & Order 12 Murder, She Wrote the file output_keys.txt should contain: 10: Will & Grace 12: Murder, She Wrote 14: Dallas…Write a program that first reads in the name of an input file and then reads the input file using the file.readlines() method. The input file contains an unsorted list of number of seasons followed by the corresponding TV show. Your program should put the contents of the input file into a dictionary where the number of seasons are the keys, and a list of TV shows are the values (since multiple shows could have the same number of seasons). Sort the dictionary by key (least to greatest) and output the results to a file named output_keys.txt, separating multiple TV shows associated with the same key with a semicolon (;). Next, sort the dictionary by values (alphabetical order), and output the results to a file named output_titles.txt. Ex: If the input is: file1.txt and the contents of file1.txt are: 20 Gunsmoke 30 The Simpsons 10 Will & Grace 14 Dallas 20 Law & Order 12 Murder, She Wrote the file output_keys.txt should contain: 10: Will & Grace 12: Murder, She Wrote 14:…Write a program that first reads in the name of an input file and then reads the input file using the file.readlines() method. The input file contains an unsorted list of number of seasons followed by the corresponding TV show. Your program should put the contents of the input file into a dictionary where the number of seasons are the keys, and a list of TV shows are the values (since multiple shows could have the same number of seasons). Sort the dictionary by key (least to greatest) and output the results to a file named output_keys.txt, separating multiple TV shows associated with the same key with a semicolon (;). Next, sort the dictionary by values (alphabetical order), and output the results to a file named output_titles.txt. Ex: If the input is: file1.txt and the contents of file1.txt are: 20 Gunsmoke 30 The Simpsons 10 Will & Grace 14 Dallas 20 Law & Order 12 Murder, She Wrote the file output_keys.txt should contain: 10: Will & Grace 12: Murder, She Wrote 14: Dallas…