Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

How Do I Use A Database Research Tools You Can Use

Authors: Laura La Bella

1st Edition

1622753763, 978-1622753765

More Books

Students also viewed these Databases questions