Python ogranicz typ parametru funkcji
def add(a:int, b:int, c:int=0) -> int:
""" Add 2 or 3 integers and return an integer result.
"""
for var in [a, b, c]:
if not isinstance(var, int) :
raise TypeError('Please make sure all inputs are integers')
result = a + b + c
return result
Trained Tuna