I'm trying to write a very simple function that I saw in the book "Learn to think like a programmer with python":
def elige_numero():
x = input("Escriba un número: ")
if x == str(17):
raise('ErrorNumeroMalo', 'El 17 es malevolo')
return x
The problem is that when in the input
I put the number 17 I get the error:
TypeError: exceptions must derive from BaseException
Does anyone know what happened and how to fix it?