0

I'm trying to create a 2 - 4 player dice rolling game that I want the user or users to choose how many players are going to be playing the game.

I made this to be an input but I only want the user to input a number between 2-4

I have tried using the "try and except" or like "while True" but these two don't work which is a pity.

def players():
    while True:
        try:
            numberOfPlayers = int(input("How many players are there? (2-4)"))
        except ValueError:
            print("Please enter a number from 2-4")

players()

This is what I've done so far but it accepts all numbers e.g. 50 and like 100 but I only want the input to be a number from 2-4

Anonymous
  • 135
  • 9

0 Answers0