Today I did a coding project. From a youtube video
while True:
players = input("Enter the number of players (2 - 4): ")
if players.isdigit():
players = int(players)
if 1 <= players <= 4:
break
else:
print("Must be between 2 - 4 players.")
else:
print("Invalid, try again.")
max_score = 50
player_scores = [0 for _ in range(players)]
while max(player_scores) < max_score:
for player_idx in range(players):
print("\nPlayer" , player_idx + 1, "turn has just started!\n")
current_score = 0
while True:
should_roll = input("would you like to roll (y) ")
if should_roll.lower() != "y":
current_score = 0
break
value = roll()
if value == 1:
print("You rolled a 1! Turn done!")
else:
current_score += value
print("You rolled a ", value)
print("You score is:", current_score)
player_scores[player_idx] += current_score
print("Your total score is:", player_scores{player_idx})