Last active
April 30, 2024 16:48
-
-
Save gleb-chipiga/943eff23361ce2951431617c697b0988 to your computer and use it in GitHub Desktop.
Выбры НП 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Никита Черняк | Дмитрий Серегин | Полина Гаврина | |
---|---|---|---|
1 | 2 | 3 | |
2 | 1 | 3 | |
3 | 2 | 1 | |
2 | 1 | 3 | |
2 | 1 | 3 | |
1 | 2 | 3 | |
1 | 2 | 3 | |
1 | 2 | 3 | |
3 | 2 | 1 | |
3 | |||
2 | 1 | 3 | |
3 | 1 | 2 | |
2 | 1 | 3 | |
3 | 1 | 2 | |
1 | 2 | 3 | |
2 | 1 | 3 | |
2 | 1 | 3 | |
2 | 1 | 3 | |
1 | 3 | 2 | |
3 | |||
2 | 1 | 3 | |
3 | 2 | 1 | |
2 | 1 | 3 | |
3 | 1 | 2 | |
2 | 1 | 3 | |
2 | 1 | 3 | |
1 | 3 | 2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import csv | |
with open("np_concil.csv") as file: | |
reader = csv.reader(file) | |
candidates = next(reader) | |
results = {c: 0 for c in candidates} | |
for row in reader: | |
row_votes = [(i, int(row[i])) for i in range(len(row)) if row[i] != ""] | |
row_votes = sorted(row_votes, key=lambda t: t[1], reverse=True) | |
for index, _ in row_votes: | |
results[candidates[index]] += 1 | |
print(results) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Дмитрий Наумов | Мария Чебыкина | Глеб Чипига | Сергей Ян | |
---|---|---|---|---|
1 | 3 | 4 | 2 | |
2 | 3 | 1 | 4 | |
1 | 4 | 2 | 3 | |
3 | 1 | 4 | 2 | |
1 | 2 | 3 | 4 | |
4 | 2 | 3 | ||
4 | 2 | 3 | 1 | |
2 | 4 | 3 | 1 | |
3 | 2 | 4 | 1 | |
4 | 2 | 3 | 1 | |
1 | 3 | 4 | 2 | |
3 | 2 | 4 | ||
4 | ||||
3 | 4 | |||
1 | 2 | 4 | 3 | |
4 | ||||
1 | 4 | 2 | 3 | |
2 | 1 | 3 | 4 | |
1 | 3 | 2 | 4 | |
1 | 2 | 3 | 4 | |
4 | 2 | 3 | 1 | |
2 | ||||
1 | 2 | 3 | 4 | |
1 | 3 | 2 | 4 | |
4 | 2 | 3 | ||
1 | 3 | 2 | 4 | |
1 | 2 | 3 | 4 | |
3 | 2 | 4 | ||
1 | 2 | 3 | 4 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import csv | |
with open("np_krk.csv") as file: | |
reader = csv.reader(file) | |
candidates = next(reader) | |
results = {c: 0 for c in candidates} | |
for row in reader: | |
row_votes = [(i, int(row[i])) for i in range(len(row)) if row[i] != ""] | |
row_votes = sorted(row_votes, key=lambda t: t[1], reverse=True)[:3] | |
for index, _ in row_votes: | |
results[candidates[index]] += 1 | |
print(results) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment