Answer to Question #290190 in Python for ashok

Question #290190

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


input

4

10

9

8

7


output should be

10

9

9

9



1
Expert's answer
2022-01-24T08:03:38-0500
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