You should validate, as requested, the input values.
Try, as starting point
def GetValue():
return int(input())
def AddAll(*args):
sum = 0
count_int = 0
count_float = 0
count_fun = 0
count_arg = len(args)
for i in args:
t = type(i)
if t is int:
count_int += 1
elif t is float:
count_float += 1
elif callable(i):
count_fun += 1
else:
print("error not allowed type " + t.__name__)
if count_int > 0 and count_int != count_arg:
print("error, not ALL int")
return -1
elif count_float > 0 and count_float != count_arg:
print("error, not ALL int")
return -1
elif count_fun> 0 and count_fun != 1:
print("error, just ONE function pointer allowed")
return -1
if count_fun == 0:
for i in args:
if i in args:
sum += (i)
else:
print("to do: handle the function pointer case")
return sum