def int_check(question): """Checks users enter an integer more than / equal to 1 and less than / equal to 150""" while True: error = "Result not rendered. Please enter an integer 1 or more (or type for infinite mode)." to_check = input(question) #Check if user wants infinite mode if to_check == "": return "infinite" try: response = int(to_check) if response < 1: print (error) elif response > 100: print(error) else: return response except ValueError: print(error) # Main Routine starts now # initialise game variables mode = "regular" rounds_played = 0 print() print("🪨🧾✂️ ... Welcome to my Rock, Paper, Scissors Game!!! ...🪨🧾✂️") print() # Instructions # Ask user for number of rounds / infinite mode num_rounds = int_check("How many rounds would you like? Push for infinite mode: ") if num_rounds == "infinite": mode = "infinite" num_rounds = 5 # game loop starts here while rounds_played < num_rounds: # Rounds heading if mode == "infinite": rounds_heading = f" --- Round {rounds_played + 1} (Infinite mode) --- " else: rounds_heading = f" --- Round {rounds_played + 1} of {num_rounds} --- " print(rounds_heading) print() user_choice = input("Choose: ") if user_choice == "xxx": break rounds_played += 1 # If users ask for infinite mode increase number of rounds! if mode == "infinite": num_rounds += 1 # game loop ends here # Game history / statistics area