Skip to content

Instantly share code, notes, and snippets.

@ychaouche
Forked from lollipoppizza/Score.py
Last active August 8, 2016 14:24
Show Gist options
  • Save ychaouche/3adb548eba56633163106ae12e266aaa to your computer and use it in GitHub Desktop.
Save ychaouche/3adb548eba56633163106ae12e266aaa to your computer and use it in GitHub Desktop.
# open csv file
file = open("X.csv")
fileReader = csv.reader(file)
# sum score
for row in fileReader[9:89]:
# sum scores for rows 10 to 90 in columns 2 and 3
score1 += int(row[1])
score2 += int(row[2])
# scoring system
score1 = round(score1*100/max(score1, score2))
score2 = round(score2*100/max(score1, score2))
# results
print("Score1: " + str(score1))
print("Score2: " + str(score2))
if score1 > score2:
print("Player 1 wins!")
elif score1 < score2:
print("Player 2 wins!")
else:
print("Draw!")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment