Skip to content

Instantly share code, notes, and snippets.

@sbaus42
Created March 3, 2022 13:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sbaus42/d4281c9b00cd1c10c27fc062d615b4ae to your computer and use it in GitHub Desktop.
Save sbaus42/d4281c9b00cd1c10c27fc062d615b4ae to your computer and use it in GitHub Desktop.
if _name_ == '_main_':
a = []
for _ in range(int(raw_input())):
name = raw_input()
score = float(raw_input())
a.append([name,score])
sorted_a = sorted(a, key=lambda x: x[1])
names_without_lowests = []
# here im evaluating if more than 1 person has the lowest grade and not adding them to the list of names. but the problem now is that the code includes everyone else.
i = 0
while i < len(sorted_a):
if sorted_a[0][1] != sorted_a[i][1]:
names_without_lowests.append(sorted_a[i])
i += 1
else:
i += 1
#here Im removing the remainder name with higher grades besides de second lowests
k = 0
names = []
while k < len(names_without_lowests):
if names_without_lowests[0][1] == names_without_lowests[k][1]:
names.append(names_without_lowests[k][0])
k += 1
else:
k+=1
sorted_names = sorted(names)
for i in sorted_names:
print(i)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment