Question: I want to make a program that can calculate physics equation where the user enters different parameters: I know its simple like:

```
v=5
t=7
s=v*t
print(s)

```

its only calculating `s = v*t`; however, when I want the equation of `v` if show me an error. Hard coding `v = s/t` gives me the correct result:

```
s=5
t=7
v=s/t
print(v)

```

I want an equation that can solve with different user input; that is if user inputs the `v` and `t` , the equation will return `s = v*t` and if the user inputs `s` and `t` the equation will return `v = s/v`.

Answer: 
You could use key word arguments:

```
def solve_equation(v=None, t=None, s=None):
    if v is not None and t is not None:
        return v * t   # s case
    elif s is not None and t:  # t not None and not 0            
        return s / t   # v case
    else:
        raise ValueError   #"t should be defined or not zero"

print(solve_equation(v=10, t=2))
print(solve_equation(s=2, t=7))

```

### Output:

```
20
0.2857142857142857

```

Note that if you are using python 2, floats must be passed.
```
def h2(v,d,t):
    title_ar = 'السرعة'
    title_en = 'speed'
    if v=='':
        print("v= ","%.2f"% (d/t),"m/s")
    elif d=='':
        print("d= ","%.2f"% (v*t),"m")
    elif t=='':
        print("t= ","%.2f"% (d/v),"s")
    else:
        print("please write all data.")

h2('', 2,6)
h2(70,'',8)
h2(25,3,'')

```