JupyterLabを使ってPython超入門
Anaconda Installers
https://www.anaconda.com/products/distribution
JupyterLabの基本操作
"ESC"でコマンドモード
- "a":新しいセルを上に挿入
- "b":新しいセルを下に挿入
- "dd":セルを削除
- "z":やり直し
"ENTER"でセルモード
電卓(対話形式)
111+111
# print(111+111)
222
2**4, 2**0.5
(16, 1.4142135623730951)
変数(variables)
x = 10
x
# print(x)
10
2**x
1024
y = x**(1/3)
y
2.154434690031884
y**3
10.000000000000002
書式(format)
age = 40
y = f"I am {age:.2f} years old."
print(y)
I am 40.00 years old.
y2 = 'I am {:.1f} years old.'.format(age+1)
y2
'I am 41.0 years old.'
リスト(List)
a = [1,3,5,10, 'pen', [1,2]]
a
[1, 3, 5, 10, 'pen', [1, 2]]
a[0], a[1], a[4], a[-1]
(1, 3, 'pen', [1, 2])
a[-1][1]
2
a[1] = 99
a
[1, 99, 5, 10, 'pen', [1, 2]]
a.append(0)
a
[1, 99, 5, 10, 'pen', [1, 2], 0]
a*2
[1, 99, 5, 10, 'pen', [1, 2], 0, 1, 99, 5, 10, 'pen', [1, 2], 0]
c=a
c[0] = 100
a
[100, 99, 5, 10, 'pen', [1, 2], 0]
辞書(dictionary)
d = {'a':'95', 'b':85}
d
{'a': '95', 'b': 85}
d['b']
85