Q:

Getting first and last function parameter in Python

I have to make a function with more than 2 arguments in python and in the end I have to print the first and the last argument of the function (in a list).
I have tried like this, but it doesn't work. What am i doing wrong?
import inspect

def func(a, b, c):
    frame = inspect.currentframe()
    args, _, _, values = inspect.getargvalues(frame)
    for i in args:
        return [(i, values[i]) for i=0 and i=n]

A:

There's also a way to get a variable number of function arguments in python (it's called var-positional). They then end into a list:
def func(*args): # The trick here is the use of the star
    if len(args) < 3: # In case needed, also protects against IndexError
        raise TypeError("func takes at least 3 arguments") 
    return [args[0], args[-1]]

A:

You are overthinking this. You already have references to the first and last arguments:
def func(a, b, c):
    print [a, c]

