學習Python過程中的筆記
Microsoft提供的Python教學頻道
https://github.com/microsoft/c9-python-getting-started
Python for Beginners [1 of 44]
預設觀賞者已經有一定程度的Programming程度,例如使用過Javascript
Python for Beginners [2 of 44]
Python是一個有彈性的(Flexible)語言,使用者可讀(Human readable)
Python for Beginners [3 of 44]
在講安裝,裝Python3以及Visual Studio Code
Python for Beginners [4 of 44]
在講安裝Visual Studio Code的Python extension
Using Print | Python for Beginners [5 of 44]
print(),可用單引號也可雙引號,但是不要換來換去的,要始終如一(不知道原因)
Demo: Hello World | Python for Beginners [6 of 44]
就是在VSC上面打一個helloworld.py,執行。還有Demo一些變數運算,print變數,以及Error(Exception)的Demo
Comments | Python for Beginners [7 of 44]
一個行的開頭有#就成為註解行,可用來說明程式,或是把某行code註解掉來debug
Demo: Comments | Python for Beginners [8 of 44]
Ctrl+K C 加Comment,Ctrl+K U uncomment
String Concepts | Python for Beginners [9 of 44]
用+加號,可以把變數組合成String,string的metode可使用 upper, lower, capitalize, count
Demo: Strings | Python for Beginners [10 of 44]
就是demo
Formatting Strings | Python for Beginners [11 of 44]
只適用於Python3的 output = f'Hello, {first_name} {last_name}
Demo: Formatting Strings | Python for Beginners [12 of 44]
就是Demo
Numeric Data Types | Python for Beginners [13 of 44]
str function把數字變數轉換成string,int function把變數轉成Integer,floadt轉成浮點數
Demo: Numbers | Python for Beginners [14 of 44]
就是Demo
Date data types | Python for Beginners [15 of 44]
開始比較複雜了,要用到datetime module,strptime把字串轉成datetime object
Demo: Dates | Python for Beginners [16 of 44]
Error Handling | Python for Beginners [17 of 44]
Error Handling vs. Debugging
Handling Multiple Conditions | Python for Beginners [21 of 44]
elif, if xxx in xxx:
Demo: Multiple Conditions | Python for Beginners [22 of 44]
Parameterized Functions | Python for Beginners [31 of 44]