So I have to find the second largest number from list. I am doing it through simple loops.
My approach is to divide a list into two parts and then find the largest number into two parts and then compare two numbers. I will choose the smaller number from two of them. I can not use ready functions or different approaches.
Basically, this is my code. But it does not run correctly
#!/usr/local/bin/python2.7
alist=[-45,0,3,10,90,5,-2,4,18,45,100,1,-266,706]
largest=alist[0]
h=len(alist)/2
m=len(alist)-h
print(alist)
for i in alist:
if alist[h]>largest:
largest=alist[h]
i=i+1
print(largest)