In [2]:
things = ["First Name", "Last Name"]
def snakify(txt):
"return string in snake_case"
return txt.replace(" ","_").lower()
print ([snakify(thing) for thing in things])
snakify( "My Name is Greg" )
Out[2]:
In [3]:
# try these out too
!dir
In [4]:
foo = ! echo hello, world
foo
Out[4]:
In [ ]:
# download salary_data.csv save contents to
# a local file in the same directory as this notebook
!curl http://www.justinmrao.com/salary_data.csv >> ./salary_data.csv
In [1]:
import pylab as pl
X = range(10)
y = range(11,21)
pl.scatter(X,y, c='r')
pl.show()
print
Out[1]:
In [3]:
%%javascript
function say_hi ( ) {
alert("Hello, World");
};
say_hi();
console.log("Welcome!");
In [4]:
from IPython.display import Image
Image("http://ipython.org/_static/IPy_header.png")
Out[4]:
In [5]:
from IPython.lib.display import YouTubeVideo
YouTubeVideo('SncapPrTusA', width=680, height=400)
Out[5]:
In [6]:
"""example taken from Scipy and NumPy by Eli Bressert (p. 6)"""
import numpy as np
def list_times(alist, scalar):
for i, val in enumerate(alist):
alist[i] = val * scalar
return alist
In [ ]:
No comments:
Post a Comment