We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
just tweak this code a little bit.
add this : scorelist = list(dict.fromkeys(scorelist))
before taking b.
if name == 'main':
marksheet=[]
scorelist=[]
for _ in range(int(input())):
name = input()
score = float(input())
marksheet+=[[name,score]]
scorelist+=[score]
scorelist = list(dict.fromkeys(scorelist))
b=sorted(scorelist)[1]
for a,c in sorted(marksheet):
if c==b:
print(a)
Nested Lists
You are viewing a single comment's thread. Return to all comments →
just tweak this code a little bit. add this : scorelist = list(dict.fromkeys(scorelist)) before taking b.
if name == 'main': marksheet=[] scorelist=[]