Skip to content

Commit

Permalink
Fix update_score not updating score due to not defining variable as g…
Browse files Browse the repository at this point in the history
…lobal
  • Loading branch information
vkleer committed Aug 3, 2022
1 parent d5c0dfc commit 4130e03
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions player_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,12 +265,14 @@ def update_score(player):
constant variable, to the player who won the game.
"""
if player == player_1_username:
player_1_wins += 1
global player_1_wins
player_1_wins = int(player_1_wins) + 1
WORKSHEET.update_cell(
WORKSHEET.find(player_1_username).row, 2, + player_1_wins
WORKSHEET.find(player_1_username).row, 3, + player_1_wins
)
elif player == player_2_username:
player_2_wins += 1
global player_2_wins
player_2_wins = int(player_2_wins) + 1
WORKSHEET.update_cell(
WORKSHEET.find(player_2_username).row, 2, + player_2_wins
WORKSHEET.find(player_2_username).row, 3, + player_2_wins
)

0 comments on commit 4130e03

Please sign in to comment.