My program needs an integer from the user, so I'm trying to create a loop that will occur if they enter a non-integer and doesn't end until they enter an integer. I've tried:
PlayerCount = input("How many players?")
while PlayerCount != int:
try:
PlayerCount = int(PlayerCount)
except ValueError:
print("Please enter a number between 3 and 5")
PlayerCount = input("How many players?")
However, when a valid input is entered the loop doesn't continue, or end and allow the rest of the program to run. I simply see a line break in IDLE and a blinking cursor. Is there something else I need to do to properly end the while loop? I expected the loop to end automatically once the try
block succeeds.