Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need solution for only assignment 2. Assignment 1 is in python language. I need answer in python language Assignment 1). This week, for the

I need solution for only assignment 2. Assignment 1 is in python language. I need answer in python language

Assignment 1). This week, for the project; re-write your solution to implement functions. In other words, you are placing some of the functionality that you already have or wish to add into functions. You should have at least two functions.

Chegg people have solved this answer last week .

grades = {} def add_grade(): subject = input("Enter subject name: ") category = input("Enter category name: ") grade = float(input("Enter grade: ")) if subject not in grades: grades[subject] = {} if category not in grades[subject]: grades[subject][category] = [] grades[subject][category].append(grade) print("Grade added successfully!") def print_grades(): for subject in grades: print("Subject:", subject) for category in grades[subject]: print("\tCategory:", category) print("\tGrades:", grades[subject][category]) def calculate_final_grades(): for subject in grades: total_weighted_grade = 0 total_weight = 0 for category in grades[subject]: category_weight = float(input("Enter weight for {} category in {} subject: ".format(category, subject))) total_weight += category_weight category_grade = sum(grades[subject][category]) / len(grades[subject][category]) total_weighted_grade += (category_grade * category_weight) final_grade = total_weighted_grade / total_weight letter_grade = calculate_letter_grade(final_grade) print("Subject:", subject) print("Final Grade:", final_grade) print("Letter Grade:", letter_grade) def calculate_letter_grade(grade): if grade >= 90: return "A" elif grade >= 80: return "B" elif grade >= 70: return "C" elif grade >= 60: return "D" else: return "F"

The grades dictionary is defined outside of the functions so that it can be accessed by all three functions. Each time a grade is added, it is added to the appropriate subject and category within the grades dictionary.

Assignment 2) This week, for the project; re-write your solution to implement classes. In other words, you are to place the functions that you created from Assignment 1 into a class.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored 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

Relational Database Technology

Authors: Suad Alagic

1st Edition

354096276X, 978-3540962762

More Books

Students also viewed these Databases questions

Question

3. Identify cultural universals in nonverbal communication.

Answered: 1 week ago

Question

2. Discuss the types of messages that are communicated nonverbally.

Answered: 1 week ago