graph a piecewise function in python
<pre><code>import matplotlib.pyplot as plt

import numpy as np

def f(x):

    if x&lt;1/2:
        return x
    else x&gt;=1/2:
        return 1-x
x=np.linspace(0,1,10)

y= f(x)
</code></pre>

<h1>I am trying to graph the function in python2.7</h1>