while True: for i in range(8): mountain_h = int(input()) # represents the height of one mountain, from 9 to 0. for i in range(9) : # Write an action using print # To debug: print("Debug messages...", file=sys.stderr) print("0") print("1") print("2") print("3") print("4") print("5") print("6") print("7") #---------- print("0") print("1")#Эти print надо вывести с циклом пропуская первые print("2")#8print print("4") print("5") print("7") print("3") print("6") #----------------------- print("5")# Эти print надо вывести с циклом, но пропуская print("2")#предыдущие 16 print и тд. до черты------- print("1") print("3") print("2") print("3") print("6") print("1") print("1") print("1") #----------------------- print("5")# и тд.до последнего варианта print print("1") #------такой чертой отвечен каждый вариант вывода print("7")# итого должно получиться 5 вариантов print("5")#более подробно можно посмотреть print("3")#задачу на www.codingame.com print("1")# 2 puzzle называется The Descent print("3") print("1") #------------------------------ print("3")
- The question is not very clear. And the intent in the code is different from what is in the problem. You need to remember the largest value of mountain_h and its index i. And after receiving all the heights of the mountains, display the index of the highest mountain. Thank you for the site - very cool)) - gil9red
- Thanks for the answer, I'll think about it. If you decide this puzzle on the site I will be grateful if you place your decision here. - Kate
- Yes, I can then lay out a solution, but will you benefit if you get a solution? :) - gil9red
- Yes, newbie. I would be very grateful. I will look and learn. I have already spent hours 5. And while no longer want. By the way, it would be interesting how to print these prints one by one. Skipping already worked. Yes, it is stupid, but everything passes separately, checked. I would appreciate that. You can in closed mode or mail. - Kate
|
1 answer
Get two variables - the maximum height of the mountain max_height = 0
and the index of the mountain with the maximum height index = -1
, in the for i in range(8):
loop for i in range(8):
compare max_height
and mountain_h
, and if mountain_h
greater than or equal to max_height
, write max_height
mountain_h
, and at index
value of the mountain i
.
After the end of the cycle, output to the console index
.
|