Answer to Question #318966 in Python for akashpatil

Question #318966

Highest Sum of Scores


1
Expert's answer
2022-03-27T07:57:43-0400

Here's the appropriate code to print the highest sum of scores:

# Highest sum of scores
group = []

# prompt user to enter an integer that denotes the number of groups
print("Enter integer N: ", end='')
n = int(input())

# prompt user to enter scores of students in each group
print(f"Enter {n} lines of scores (separated by comma):")
for i in range(n):
    a = input().split(',')
    group.append([])
    sum_group = 0
    for j in range(len(a)):
        group[i].append(int(a[j]))
        sum_group += group[i][j]
    if i == 0:
        max = sum_group
        ind_max = i
    elif max < sum_group:
        max = sum_group
        ind_max = i

print('Output:')
for j in range(len(group[ind_max])):
    print(group[ind_max][j], end=' ')

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS