Answer to Question #226125 in Python for Reclimet

Question #226125

Maximum

n = int(input())
line = []

for i in range(0, n):
  line.append(input())
  print(max(line))

In this python program it has three test cases, in this three test cases two test cases was getting expected output and third test case are not getting expected output. Please give me expexted output for three test cases. Thank you !


Question Url :-

https://docs.google.com/document/d/1z0yr9wfjkiTADlYer1IJgNn2w8x3_HJG/edit?usp=sharing&ouid=104486799211107564921&rtpof=true&sd=true


Test Case 1

Input

6

1


3

2

9

8

Output

1

1

3

3

9

9

Test Case 2

Input

5

1

2

3

4

5

Output

1

2

3

4

5

Test Case 3

Input

4

10

9

8

7

Output

10

10

10

10


1
Expert's answer
2021-08-14T02:47:10-0400

Your code compares str values, not int. Code shall be as follows:

n = int(input())
line = []

for i in range(0, n):
    line.append(int(input()))
    print(max(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

Reclimet
14.08.21, 11:13

OK sir. Thank you for your valuable information provided to me

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS