Transcription of Python 入門 テキスト - 明治大学
1 2020 9 Python 1 Python 1 AI IoT Dropbox Instagram Pinterest Web Blender Maya 3D 3D-CAD Python Python Python Python numpy matplotlib 2 Python Python Python 1991 1994 Python1 Python1.. 2000 Python2 2.. 2008 Python3 3.. 2020 1 2 3 3 2 3 2 Python 3 2 3 Python print print 2 print 3 print( ) 2 ASCII 3 UTF-8 3 3 OS Windows CentOS macOS OS [4] 2 Python .
2 4 .. 4 help .. 5 .. 6 Jupyter Notebook .. 7 Python .. 10 .. 10 .. 14 .. 15 .. 18 .. 24 .. 27 .. 29 .. 32 .. 34 .. 36 Python .. 40 NumPy .. 40 matplotlib .. 46 CSV .. 49 .. 51 .. 52 1. x2 .. 47 2. sin, cos .. 48 3. kaggle .. 49 4.. 50 3 1. Jupyter Notebook .. 9 2.. 11 3.. 12 4.. 15 5. Python .. 51 4 Python Python Python Jupyter Notebook Python Python Windows PowerShell Windows Power Windows PowerShell CentOS macOS PowerShell Python >>> PC 5 [ 1] Python Python Hello World print Python print() exit()
3 Help Python help() print help("print") help() help help >>> help> 6 q Z Python mkdir Python cd Python 7 py Python Python Python < > print Jupyter Notebook Jupyter Notebook ( Jupyter Notebook )
4 Jupyter Notebook Jupyter Notebook Power Shell jupyter notebook New Python3 .ipynb Untitled File Rename test print("Hello World") print("1 + 3 = " + str(1 + 3)) 4 * 8 8 Hello World Run Shift Enter Cell Cell Jupyter Notebook Cell Cell Cell Cell Run Cell Run All 3 Cell Cell Cell Kernel Restart & Run All Cell Jupyter Notebook File Save and CheckPoint 9 Jupyter Notebook 1 1.
5 Jupyter Notebook Shift Enter Cell Cell Ctrl Enter Cell Ctrl S Enter K Cell J Cell A Cell B Cell X Cell C Cell D Cell Shift + M Cell Z Cell O Cell / I Cell O Cell H Esc Crtl M Tab Ctrl ] Ctrl [ Ctrl A Ctrl Z Ctrl / / Cell Cell Cell Cell OS 1 H 10 Python Python _ 1 _ Python (and for if )
6 [5] Python _ = Python _variable, variable, variable1, Variable, VARIABLE 1, 11, 12345, 1variable 11 Python Python 2 2. int - 3 i j 5 float - complex - 2 + 3j str ( ' ) ( " ) "Hello World" 'Hello World' list [ ] [1, 2, 3] [1, "a", 2, "b"] [1, [2, 3]] tuple ( ) (1, 2, 3) (1, "a", 2, "b") (1, (2, 3)) set { } {1, 2, 3} {"Hello", "World", 1} dict key:value { } {1: "Hello", 2: "World"} {"a": 1, "b": 2} bool True ( ) False ( ) 12 type( ) 3.
7 X + y s + t s t x y s * x s x x * y x / y x % y x ** y x // y 3 1. ** 2. *, /, %, // 3. +, ( ) 13 In[1] 2 [ 2] int( ) float( ) str( ) int( ) 14 Python for x = "test" for i in range(5).
8 Print(x) 15 Python 4 Tab 1 [ 3] if Python if if else elif 3 1 if 2 if else 3 if else elif 4 4 4. x == y x y x != y x y x > y x y x >= y x y x < y x y x <= y x y x = "test" for i in range(5): print(x) if 1: 1 elif 2: 1 2 elif 3: 1, 2 3 else: 1~3 16 True False if elif True if Python if C Java { } if for while if-else elif input [ 4] x = 1 if x == 1: print("x 1 ") else: print("x 1 ") x = int(input(" >>>")) if x == 0: print("x 0 ") elif x < 0: print("x ") else.
9 Print("x ") 17 input int( ) and or and Python == True is True ID ID id() ID ID x = int(input(" >>>")) if 0 <= x and x < 10: print("0 10 ") elif x < 0 or 10 <= x: print("0 10 ") if 0 <= x < 10: print("0 10 ") 18 None True False is == Python == is is 50 50 1 50 nameN Python Python name1 = "John" name2 = "Ewan" name3 = "Jacob" name4 = "David" name5 =.
10 # names = ["John", "Ewan", "Jacob", "David", "Tom", ..] 19 [ ] , 1 Python 0,1,2,.. 0 [2:4] 2 "c" 3 "d" 4 "e" [:: 1] [ 1, 2, ..] [ ] [ : : ] 20 len len len.