Question: Using Python, I am having difficulty adding up the input values for scores and maxes. Below is an example of what should be printed out

Using Python, I am having difficulty adding up the input values for scores and maxes. Below is an example of what should be printed out and a copy of my code. Calculating the last two lines is where I get lost (primarily Total points). Total points is calculated by summing all assignment scores and section attendance (each lecture is worth 5 points and is capped at 34 points). The max score represents the maximum score possible. After inputting values for all assignments and listing the total sections attended they are summed up and displayed as a fraction.

When I input only 1 assignment score I can calculate the correct value; however, I am looking for advice how to store multiple input values (homework grades) and sum them together to calulate total points.

For further clarification,

Homework: Weight (0-100)? 50 Number of assignments? 3 Assignment 1 score? 14 Assignment 1 max? 15 Assignment 2 score? 17 Assignment 2 max? 20 Assignment 3 score? 19 Assignment 3 max? 25 How many sections did you attend? 5 Section points = 15 / 34 Total points = 65 / 94 Weighted score = 34.6 / 50 

my homework functin

def homework(): weight = int(input("Weight (0-100)?" )) num_assignments = int(input("Number of assignments? "))

index = 0 while index < num_assignments: print("Assignment", index+1, " score?", end='') assign_score = int(input()); print("Assignment", index+1, " max?", end='') assign_max = input(); index = index + 1 scorelist = assign_score.split() total = sum([int(i) for i in scorelist()]) section_att = int(input("How many sections did you attend? ")) section_points_calc = section_att * 5 section_points_print = print("Section points = {} / 34" .format(section_points_calc))

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!