Since head
and tail
are being called by passing arguments to them (items
is the argument to both), you should declare them as functions:
def head(items):
# ...
return ...
def tail(items):
# ...
return ...
Note:
- If this is a homework, then the problem statement should specify what are those functions supposed to do.