5. jupyter-executeの見本

name = 'world'
print('hello ' + name + '!')
import matplotlib.pyplot as pyplot
pyplot.plot(range(100))
pyplot.draw()
hello world!
../_images/jupyter_execute_sample_0_1.png
this code is invisible
print('this output is invisible')
this output is above the code
print('this output is above the code')
1print('A')
2print('B')
3print('C')
A
B
C
7print('A')
8print('B')
9print('C')
A
B
C
d = {
'a': 1,
'b': 2,
'c': 3,
'd': 4,
'e': 5,
}
1 / 0
---------------------------------------------------------------------------
ZeroDivisionError                         Traceback (most recent call last)
<ipython-input-9-bc757c3fda29> in <module>
----> 1 1 / 0

ZeroDivisionError: division by zero
a = {'hello': 'world!'}
a['jello']
---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
<ipython-input-10-c54633378b1e> in <module>
      1 a = {'hello': 'world!'}
----> 2 a['jello']

KeyError: 'jello'
import sys

print("hello, world!", file=sys.stderr)
hello, world!

CountDigits