In [10]:
#comments which are not run are denoted with #
#hello world
#try running this cell clicking inside it and pressing shift+enter
#python3
print("hello world")
In [7]:
%lsmagic
#shows you all available magics, these allow you to run many different
#commands on a single line, such as "load_ext" to load functions or "time" to time your code
#cell magics can interpret many other languages
Out[7]:
In [8]:
%%perl
#can use magic to run whole cell as perl
print "hello world"
In [ ]:
%%bash
#or make cell bash
echo "hello world"
In [ ]:
#bash commands inside python kernel
!echo "hello world"
In [5]:
#can even store output of bash commands and use in python
string = !echo "hello world"
print(string)
Jupyter (JuliaPythonR) is essentially a wrapper of kernels. A kernel takes text, compiles it according their respective rules and outputs machine code which is then executed on the CPU/GPU. Jupyter allows you to switch between different kernels by goint to Kernel-->Change Kernel at the top.
In [ ]:
#switch to Bash kernel
echo "hello world"
In [ ]:
#switch to R kernel
print("hello world")
In [ ]:
#switch to C kernel
printf("hello world");
In [6]:
#switch to python2 kernel
print "hello world"
In [1]:
from datetime import timedelta
from IPython.display import YouTubeVideo
start=int(timedelta(hours=0, minutes=0, seconds=0).total_seconds())
YouTubeVideo("rOU4YiuaxAM", start=start, autoplay=1, theme="light", color="red")
Out[1]: