A natural number n representing the number of students is input, and each student's name is Key and a list of Korean, English, and math scores is stored as Value. Print the name of the student with the highest average of all students and their average score. (The average score is only output to the second decimal place.) (If there are students with the same average score, print out the students stored further in the dictionary.)
n = int(input())
dic = {}
p = []
for i in range(n) :
s = []
key = input()
k = int(input())
e = int(input())
m = int(input())
s.append(k)
s.append(e)
s.append(m)
dic[key] = s
avg = sum(s) / 3
p.append(avg)
for i in dic :
for j in dic :
if dic[i] < dic[j] :
max_avg = j
print("Top :", max_avg)
print("avg : %.2f" % max(p))
I don't know what's wrong...
python
if dic[i] < dic[j] :
In the section, we are not comparing the average score.
773 When building Fast API+Uvicorn environment with PyInstaller, console=False results in an error
553 GDB gets version error when attempting to debug with the Presense SDK (IDE)
556 PHP ssh2_scp_send fails to send files as intended
554 Understanding How to Configure Google API Key
553 Uncaught (inpromise) Error on Electron: An object could not be cloned
© 2024 OneMinuteCode. All rights reserved.