def main():
a = [2,1,5,234,3,44,7,6,4,5,9,11,12,14,13]
max = 0
for number in a:
if number > max:
max = number
print max
if __name__ == '__main__':
main()
I am able to get the maximum value in the array (without using max() of course...). How can I get the index (position) of that value? Please try to keep it simple without using new Python key words or built-in functions. Thanks!
if number > max
could be considered using the builtin method__gt__
of the built-in typelist
:) Seriously though - why can't you just use the built-inmax
- just an intellectual exercise or self-torture?max
is the correct, concise and efficient method for this in Python, but you're after ways of how not to do it?