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

Lab 5 - (Function) my_strip()

def my_replace(word):
   result=""
   i = 0
   while(i<len(word)):
        if(word[i] != " "):
           result = result + word[i]
        i = i+1
   return result
     
my_replace("Thailand    ")
assert (my_replace("Thailand    ") == "Thailand" )
print (my_replace("Thailand    "))


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

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