Hi I'm trying to understand how to implement optional arguments in a python function. For example, in the basic function below
def Ham(p,*q):
if q:
print p+q
else:
print p
Ham(2)
Ham(2,3)
I expect Ham(2) to return '2' which it does, however Ham(2,3) gives an error.
EDIT: Many thanks. Many of your answers were useful.