You can use try-except blocks to handle errors in user input. Here's an example: try: user_input = int(input(Enter a number: ))except ValueError: print(Invalid input. Please enter a number.)else: print(User input received:, user_input)