วันอาทิตย์ที่ 4 ตุลาคม พ.ศ. 2558

Lab 5 - (Function) my_count()

def my_count(word,check):
    i = 0
    count = 0
    while (i<len(word)):
        if (word[i] == check):
            count = count + 1
        i = i + 1
    print (count)
 
my_count("thailand","a")  


ไม่มีความคิดเห็น:

แสดงความคิดเห็น