Here is the code I was using:
def arithmetic_arranger(eq1 = '', eq2 = '', eq3 = '', eq4 = '', eq5 = '', answers = False):
try:
print(eq1 + eq2 + eq3 + eq4 + eq5)
except TypeError:
raise('Does not work')
arithmetic_arranger('hello', 'hola', 'konnichiwa', 'bonjour', 'hi', 'hey', 'sup')
I want to call the function, and if there are more than 5 arguments (excluding variables) then it should return (for my purposes) 'Does not work'. This is my first time dealing with exceptions, and I cannot seem to figure out how to deal with it coming from inside the function.
Tried:
def arithmetic_arranger(eq1 = '', eq2 = '', eq3 = '', eq4 = '', eq5 = '', answers = False):
try:
print(eq1 + eq2 + eq3 + eq4 + eq5)
except TypeError:
raise('Does not work')
arithmetic_arranger('hello', 'hola', 'konnichiwa', 'bonjour', 'hi', 'hey', 'sup')
Got:
TypeError: arithmetic_arranger() takes from 0 to 6 positional arguments but 7 were given
Expecting:
Does not work