I'm creating a dice game. I'm stuck, I want the game to compare for each player's roll output roll = randint(1, 6)
so the player with the highest score wins. But, I really don't know how to do that.
from random import randint
def main():
player = int(input('How many players> '))
step = 1
player += 1
player_dict = {}
for pl in range(1, player, step):
player_name = input(f'Player {str(pl)} name> ') # Get players name from user input
player_dict[pl] = player_name
for x in player_dict:
roll_dice(player_dict[x])
def roll_dice(player_name):
start_rolling = input(f'{player_name} roll dice? y/n> ')
if start_rolling == 'y' or start_rolling == 'Y':
roll = randint(1, 6)
print(roll)
return roll_dice