Feb-11-2021, 09:39 AM
(Feb-11-2021, 05:15 AM)deanhystad Wrote: import randomfrom time import sleep def get_players(): """Get players names and initialize scores""" players = [] for i in range(2): players.append({'name':input('Enter Player {i+1} Name: '), 'score':0}) return players def roll_dice(players): """Give each player a turn. Players roll two dice. Players are awarded the total of the two dice. If the total is even, the player is awarded a 10 point bonus. If the total is odd, the player is penalized 5 points. If the player rolls doubles they roll an additional die and are awarded a bonus equal to the value of the die. """ def play_game(players): """Play the dice game. Players get 4 rolls and the player with the highest score wins. If players are tied after 4 rolls they continue to roll until the tie is broken. """ for _ in range(4): roll_dice(players) while players[0]['score'] == players[1]['score']: print('The score is tied! Tiebreaker roll!') roll_dice(players) if players[0]['score'] > players[1]['score']: winner, loser = players else: loser, winner = players print(f'\n{winner["name"]} wins with {winner["score"]} points!') print(f'{loser["name"]} finishes with {loser["score"]} points\n\n') players = get_players()play_game(players)where would I put that ? do I replace the roll function with that