https://www.codingame.com/training/easy/the-descent
import sys
import math
# The while loop represents the game.
# Each iteration represents a turn of the game
# where you are given inputs (the heights of the mountains)
# and where you have to print an output (the index of the mountain to fire on)
# The inputs you are given are automatically updated according to your last actions.
# game loop
while True:
mountains_h = []
for i in range(8):
mountain_h = int(input()) # represents the height of one mountain.
mountains_h.append(mountain_h)
max_mountain = 0
for i in mountains_h:
if max_mountain < i :
max_mountain = i
for i in range(len(mountains_h)):
if mountains_h[i] == max_mountain:
target = i
break
# Write an action using print
# To debug: print("Debug messages...", file=sys.stderr, flush=True)
# The index of the mountain to fire on.
print(target)