Answer to Question #223688 in Python for Ravi

Question #223688

Maximum

You are given

N number of inputs. Print the maximum of them after each input.Input

The first line of input is an integer

N. The next N lines each contain an integer as input.Explanation

In the example, you are given

6 inputs 1, 0, 3, 2, 9, 8.

1 is maximum in the input 1.

1 is maximum in the input 1, 0.

3 is maximum in the input 1, 0, 3.

3 is maximum in the input 1, 0, 3, 2.

9 is maximum in the input 1, 0, 3, 2, 9.

9 is maximum in the input 1, 0, 3, 2, 9, 8.

 


So, the output should be


1

3

3

9

9




1
Expert's answer
2021-08-05T14:23:19-0400
n = int(input())
line = []

for i in range(0, n):
    line.append(input())
    print(max(line))
    # print(f'{max(line)} is maximum in the input {", ".join(line)}')

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS