Skip to content

Instantly share code, notes, and snippets.

@lollipoppizza
Created August 8, 2016 11:47
Show Gist options
  • Save lollipoppizza/ddc9ea1733f82bb42f3dd2c758b3246d to your computer and use it in GitHub Desktop.
Save lollipoppizza/ddc9ea1733f82bb42f3dd2c758b3246d 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:
# sum scores for rows 10 to 90 in columns 2 and 3
if 8 < fileReader.line_num < 90:
score1 += int(row[1])
score2 += int(row[2])
# scoring system
score1 = round((score1/max(score1, score2)*100))
score2 = round((score2/max(score1, score2)*100))
# 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