def setup():
n=[1,5,10,4,6,8,7,10,1,1,9,1]
print("the last index of maximum number = ",lastIndex(n))
def lastIndex(n):
i=len(n)-1
index=0
max_n=n[i]
while(i>0):
if(max_n<n[i]):
max_n=n[i]
index=i
i=i-1
return index
setup()
ไม่มีความคิดเห็น:
แสดงความคิดเห็น