CSCI 145
program must be in python 3.0
grades.txt contains the final grades for students in CSCI 145. The dean would like to see a breakdown of who passed, who did not, and the total percentages of each group. Write a program that prompts for the file path to grades.txt, reads in grades.txt, and produces two files -- passed.txt and wdf.txt. passed.txt should contain the names of the students who received a grade of A, B, or C. wdf.txt should contain the names of the students who received a W, D, or F. Additionally, you should output the percentage of students who passed and the percentage of students who received a W, D, or F to the console.
Each line in grades.txt represents a student’s name and his/her final grade. Your program should work with a grades.txt that contains an arbitrary number of lines. The lines are in the following format: name grade
For example, below is an sample of what grades.txt may look like:
grades.txt
Alice F Bob B Charles C Dawn A Eve D Fred W |
Using the above as an example, your program should generate the following text files:
passed.txt
Bob Charles Dawn |
wdf.txt
Alice Eve Fred |
Sample Execution
Please give thumbs up, if it is helpful for you. Let me know if you have any doubt. # -*- coding: utf-8 -*- """ Created on Wed Apr 25 10:24:28 2018 @author: """ file = input('Grades filepath: ') # input file infile = open(file, 'r') # open file to read data = [] # to hold all the data for line in infile: # iterate over each line in file line = line.strip().split(' ') # seperate each file line using space data.append(line) infile.close() # close file passed = [] # empty list to hold passed students wdf = [] # empty list to hold wdf students for val in data: if val[1] in 'ABC': passed.append(val) else: wdf.append(val) outfile1 = open('passed.txt', 'w') # open file to write passed students outfile2 = open('wdf.txt', 'w') # open file to write wdf students for val in passed: outfile1.write(val[0] + '\n') # writing to file..passed students for val in wdf: outfile2.write(val[0] + '\n') # writing to file..wdf students perc_pass = len(passed) / len(data) * 100 # find passed percentage perc_wdf = len(wdf) / len(data) * 100 # find wdf percentage print('Percentage Passed: ' + str(round(perc_pass, 2)) + '%') print('Percentage WDF: ' + str(round(perc_wdf, 2)) + '%') outfile1.close() # close file outfile2.close() # close file
Output:
CSCI 145 program must be in python 3.0 grades.txt contains the final grades for students in...
THIS IS A PYTHON PROGRAM student.txt Ann Bob Carla Dennis Eric Frank Greg Harry faculty.txt Fred Wilma Betty Barney Slate Gazoo staff.txt Karen Bob Carla Joan DeeDee Michelle alumni.txt John Jane Wilma Barney Gazoo DeeDee Joan Suppose you have been provided four (4) input files that contain the names of persons who are affiliated with Clark Atlanta University in various capacities. You have been asked to write a Python program - that uses "sets" - to complete the following tasks:...
(IN PYTHON) You are to develop a Python program that will read the file Grades-1.txt that you have been provided on Canvas. That file has a name and 3 grades on each line. You are to ask the user for the name of the file and how many grades there are per line. In this case, it is 3 but your program should work if the files was changed to have more or fewer grades per line. The name and...
Problem: Who Is within D Degrees of Separation? Given a series of "knows" relationships such as "Alice knows Bob", a degree D, and a person P, output the group of people that are within D degrees of separation of person P For example, given the input, which consists of a network of acquaintances followed by one or more queries of the form "degree person" such as Alice knows Bob Carol knows Dave Carol knows Bob Bob knows Eve Eve knows...
c++ implement a student class Determine the final scores, letter grades, and rankings of all students in a course. All records of the course will be stored in an input file, and a record of each student will include the first name, id, five quiz scores, two exam scores, and one final exam score. For this project, you will develop a program named cpp to determine the final scores, letter grades, and rankings of all students in a course. All...
[JAVA/chapter 7] Assignment: Write a program to process scores for a set of students. Arrays and methods must be used for this program. Process: •Read the number of students in a class. Make sure that the user enters 1 or more students. •Create an array with the number of students entered by the user. •Then, read the name and the test score for each student. •Calculate the best or highest score. •Then, Calculate letter grades based on the following criteria:...
in java by using the loop Write a program that finds all students who score the highest and lowest average marks of the first two homework in CS (I). Your program should read the data from a file called "hw2.dat" and displays the output to another file called “hw2.out” and on the screen. The first line of the input file contains the number of students, N. The next N lines contain information about the students. Each data line contains student...
Write a C program to compute average grades for a course. The course records are in a single file and are organized according to the following format: Each line contains a student’s first name, then one space, then the student’s last name, then one space, then some number of quiz scores that, if they exist, are separated by one space. Each student will have zero to ten scores, and each score is an integer not greater than 100. Your program...
THIS IS FINAL COURSE ASSIGNMENT, PLEASE FOLLOW ALL REQUIREMENTS. Hello, please help write program in JAVA that reads students’ names followed by their test scores from "data.txt" file. The program should output "out.txt" file where each student’s name is followed by the test scores and the relevant grade, also find and print the highest test score and the name of the students having the highest test score. Student data should be stored in an instance of class variable of type...
Write a C++ program to store and update students' academic records in a binary search tree. Each record (node) in the binary search tree should contain the following information fields: 1) Student name - the key field (string); 2) Credits attempted (integer); 3) Credits earned (integer); 4) Grade point average - GPA (real). All student information is to be read from a text file. Each record in the file represents the grade information on...
python 3 question Project Description Electronic gradebooks are used by instructors to store grades on individual assignments and to calculate students’ overall grades. Perhaps your instructor uses gradebook software to keep track of your grades. Some instructors like to calculate grades based on what is sometimes called a “total points” system. This is the simplest way to calculate grades. A student’s grade is the sum of the points earned on all assignments divided by the sum of the points available...