Lowest and Highest score
The teacher gave out the scores of the science quiz conducted last week and asked the ones with the lowest and highest scores to group up. Print the names of the students with minimum and maximum scores, respectively.
Note: In case of a tie, choose the name which comes first in the (dictionary order).
Sample Input1
2
shakti 24
disha 26
Sample Output1
shakti disha
Sample Input2
3
ajay 23
bijay 24
sanjay 23
Sample Output2
ajay bijay
n = int(input('Enter number here: '))
dic = {}
for i in range(n):
j = input('Enter scores and names here: ').split(' ')
dic[j[0]] = int(j[1])
print(max(dic))
print(min(dic))
Enter number here: 2
Enter scores and names here: shakti 24
Enter scores and names here: disha 26
shakti
disha
Comments
Leave a comment