以前在學校對於程式實在沒興趣以至於學得哩哩落落的
現在開始重新學習發現這個Funtion和method的差別的概念實在太重要了
第一至少你得知道語法,不然連程式都寫不出來呢
function(函数)語法 | method(方法)語法 |
|
|
def my_function(fname): print(fname + " Refsnes") my_function("Emil") my_function("Tobias") my_function("Linus") |
txt = "I love apples, apple are my favorite fruit" y = txt.count("apple") print(y) |
Emil Refsnes Tobias Refsnes Linus Refsnes |
2 |
Coursera 筆記如下:
from University of Michigan->Introduction to Data Science in Python->Week 1-> Python Functions
文章標籤
全站熱搜