comp_sc = 0
game_start = False
def main():
turn_start = input('Are you Ready to play? ').lower()
if turn_start == 'n':
game_start = False
print('No one is willing to play!!!')
if turn_start == 'y':
game_start = True
#while game_start == True:
for x in range(1, 5):
com_move(comp_sc)
def roll():
***
def com_move(comp_sc):
turn_score = int(roll())
if turn_score < 6:
comp_sc =+ turn_score
print(comp_sc, 'comp_sc')
elif turn_score == 6:
comp_sc =+ 0
game_start = False
return comp_sc
in my com_move function, I don't see turn_score (which is outputting a random number through random module) adding it in comp_sc variable. when I run this function - comp_sc is always equal to turn_score - instead of adding up all the 5 turn_score in it.
Thank you
globalkeyword to write to global variables.+=and not=+to add tocomputer_score