Q:

passing variable arguments in python

I need to define a function that may or may not take one argument of the 3 arguments defined in a function. However, I get an error message as invalid syntax. 
Now, if I make my third argument as variable [value3], I get an error message as 'float' object is not iterable. 
Also, I have realized that when all the arguments are passed, it creates a tuple, which is unfavorable. 
Could someone help me solve the problem?
def createValues(value1, *value2, value3):
    value = dict()
    value["VALUE1"] = value1
    value["VALUE2"] = value2
    value["VALUE3"] = value3

    print (value["VALUE1"],value["VALUE1"],value["VALUE1"])

createValues(2000,21000001,1)
createValues(2000,,1)

A:

What you want is default arguments. This allows your function to be called by passing only a part of its parameters, and defaults the other to a pre-defined value.
For instance:
def createValues(value1=12, value2=27, value3=42):
    value = dict()
    value["VALUE1"] = value1
    value["VALUE2"] = value2
    value["VALUE3"] = value3

    print (value["VALUE1"],value["VALUE1"],value["VALUE1"])

will allow you to call your function by either of the following ways:
>>> createValues(1, 2, 3)
1, 2, 3
>>> createValues()
12, 27, 42
>>> createValues(value2=1)
12, 1, 42
>>> createValues(0, 5)
0, 5, 42

Since you seem confused with the * unary operator, I suggest that you read a bit about arguments unpacking (for example, check this post).
Besides, using two commas as in createValues(2000,,1) is in no way a valid syntax in Python.

