วันอังคารที่ 24 พฤศจิกายน พ.ศ. 2558

Lab 6 : Find total number of chairs (in the building)

def setup():
   first = [15,13,7,11,9]
   second = [19,12,22,29,25]
   third = [23,20,34,33,35]
   fourth = [49,38,33,45,41]
   floor = [first,second,third,fourth]
 
   ifloor = 0
   total = 0
 
   while(ifloor<len(floor)):
      iroom = 0
      while(iroom<len(floor[ifloor])):
            total = total+floor[ifloor][iroom]
            iroom = iroom+1
      ifloor = ifloor+1
   print("Total number of chairs =",total)



setup()

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

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