Computer Fundamental
วันอาทิตย์ที่ 4 ตุลาคม พ.ศ. 2558
Lab 5 : Find index of (the first) maximum value in array
def setup():
i = 0
index = 0
n = [5,6,23,9,20,10,23,9]
maxi = n[0]
while(i<len(n)):
if(maxi<n[i]):
maxi = n[i]
index = i
i = i+1
print("Index of maximum = ",index)
setup()
ไม่มีความคิดเห็น:
แสดงความคิดเห็น
บทความใหม่กว่า
บทความที่เก่ากว่า
หน้าแรก
สมัครสมาชิก:
ส่งความคิดเห็น (Atom)
ไม่มีความคิดเห็น:
แสดงความคิดเห็น