Simple Data Visualization


In [2]:
from pylab import *
x = linspace(0,2*pi,150)
y = exp(sin(x))
plot(x,y)
show()


For Loops


In [3]:
for x in range(9):
    print(x)


0
1
2
3
4
5
6
7
8

Creating Functions


In [4]:
def five_thru_seven(x):
    if x<8 and x>4:
        return x*2
    else:
        return x
print(five_thru_seven(8))


8

In [6]:
print(five_thru_seven(6))


12

In [13]:
from pylab import *
x = linspace(0,10,100)
y = [five_thru_seven(i) for i in x]

In [15]:
plot(x,y); show()



In [ ]: