2.5 Debugging

Error message

Python 裡會顯示 traceback

可以把問題拿去google

def printInches(n):

print str(n) + " inches"

指定輸出的數字是str

介紹len()

算出有幾個element

http://www.tutorialspoint.com/python/list_len.htm

不同版本的 Code 不好比較

不要 copy code to different version

Version control system,Git

Super powerful undo system that let you navigate to any version that have multiple version and share different version

Debugging Strategy Recap

5個小訣竅:

4.Check (print) intermediate results

Correcting locating errors is a big part of writing reliable software

Commenting well to aid debugging

**

**

docstring- 在 Start functions with a comment 裡面

docstring is a multi-line string that acts as a descriptive comment for a function, but it is retained by the computer as the code executes and can be accessed by users as your code runs.

results matching ""

    No results matching ""