Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Will you please answer in PYTHON language. The last 3 questions have been answered in an incorrect language thus rendering it useless, wasting a question,

Will you please answer in PYTHON language. The last 3 questions have been answered in an incorrect language thus rendering it useless, wasting a question, and isnt helping me at all. I am going to provide the code I have written and will also post what it is supposed to look like below that and merely want you to go over it and double check it to make sure it looks good and I do not need to make any changes. Pretty please, thank you.

def determine_grade(self): file = open("Grades.txt", "r")#open the file to read writeFile = open("HowManyHours","w")#open file to write

for line in file:#read file line by line line_list = line.split()#split into a list if len(line_list) == 4: name = line_list[0] + " " + line_list[1] credits = int(line_list[2]) study_hours = int(line_list[3])

if study_hours >= 15 * credits: grade = "A" elif study_hours >= 12 * credits: grade = "B" elif study_hours >= 9 * credits: grade = "C" elif study_hours >= 6 *credits: grade = "D" else: grade = "F" if credits > 0 and credits <= 55: writeFile.write("Full Name:" + name.title() + " ") writeFile.write("Credits: " + str(credits) + " ") writeFile.write("Study Hours: " + str(study_hours) + " ") writeFile.write("Grade: " + grade + " ")

file.close()#close the files writeFile.close()

This is the code i have written myself. It is supposed to read in data from Grades.txt and the program determine the amount of study hours by the grade provided. The data will look like this, I had to physically make the file to be read in. It will start out as having

FullName: Julio Jones

Credits: 12

Study Hours: 36

THe program will then determine the grade and will write all new information to the file HowManyHours.txt.

Here is the minimum study hour/ grade chart. and i will also post what the output is supposed to look like to help.

Minimum Study Hours per Week per Class Grade 15 A 12 B 9 C 6 D 0 F

And this is what the output is supposed to look like

FullName: Patrick Mahomes

Grade: C

Credits: 12

WeeklyStudyHours: 36

The weekly study hours determined is not within the range value of 0 to 168,

please enter a correct value:

Please enter the total number of weekly study hours: 168

FullName: Deshaun Watson

Grade: A

Credits: 9

WeeklyStudyHours: 168

You entered 55 which is an incorrect value for credits

Please enter the number of credits you are taking such as 3 for 3 credits: 3

FullName: Drew Brees

Grade: A

Credits: 3

WeeklyStudyHours: 15

FullName: Julio Jones

Grade: C

Credits: 15

WeeklyStudyHours: 45

FullName: Jahseh Kuro

Grade: C

Credits: 9

WeeklyStudyHours: 27

FullName: James Noir

Grade: C

Credits: 6

WeeklyStudyHours: 18

FullName: Kid Cudi

Grade: C

Credits: 12

WeeklyStudyHours: 36

FullName: Cecilia Yadman

Grade: C

Credits: 15

WeeklyStudyHours: 45

FullName: Zach Houston

Grade: C

Credits: 3

WeeklyStudyHours: 9

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Financial Accounting An Introduction to Concepts, Methods and Uses

Authors: Roman L. Weil, Katherine Schipper, Jennifer Francis

14th edition

978-1111823450, 1-133-36617-1 , 1111823456, 978-1-133-3661, 978-1133591023

Students also viewed these Databases questions