Answer to Question #237472 in Python for kaavya

Question #237472

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

Sample Input 1

6

1


3

2

9

8

Sample Output 1

1

1

3

3

9

9

Sample Input 2

5

1

2

3

4

5

Sample Output 2

1

2

3

4

5


1
Expert's answer
2021-09-18T02:58:37-0400
N = int(input())
integerNumbers = []
for i in range(0, N):
    integerNumbers.append(input())
    print(max(integerNumbers))

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