#------------------------------------------ # Name: Tynan # Purpose: Checking Input validation # Author: ron-dogg # Created: 26/02/2025 # Copyright: (c) rwz 2025 # Licence: I don't need a licence brah! #------------------------------------------ # Checking for name validation. Will only accept names with no numbers or spaces. while True: name = str(input("What is your name? ")) if name.isalpha(): # We don't need == True, because .isalpha() already returns a boolean break else: print("That is not an acceptable name. Please try again.") # Checking for integer input validation while True: try: rounds = int(input("How many rounds do you want to play? 1-5: ")) if rounds < 1 or rounds > 5: # If the user inputs a number above 5 or below 1, it asks again print("Please choose a number between 1 and 5.") else: break # Exit the loop when a valid input is provided except ValueError: # If the user doesn't input a valid number, it asks again print("You didn't even put in a number! How am I supposed to process that, bro?")