Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def largestElementIndex(lst):
- x=0
- maxNum=0
- while x+1 < len(lst):
- if lst[x] > maxNum:
- maxNum=x
- x+=1
- return maxNum
- print "Program Output"
- indexOfMax = largestElementIndex([1, 4, 3, 3, 2])
- print 'Index Of Max Value is',indexOfMax
- def largestElementIndex(lst):
- x=0
- maxNum=0
- maxIndex=0
- while x < len(lst):
- if lst[x] > maxNum:
- maxIndex=x
- maxNum=lst[x]
- x+=1
- return maxIndex
- def largestElementIndex(lst):
- max_index = 0
- max_value = lst[0]
- for index, value in enumerate(lst)
- if value > max_value:
- max_index = index
- max_value = value
- return max_index
- max_index = max(enumerate(lst), key=lambda pair: pair[1])[0]
- res = lst.index(sorted(lst)[-1])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement