Contest Code:PRACTICE Problem Code:UWCOI20A

i am not able to run this
help me guys
i runned this successfully in compiler but in codechef its not working

largest_mountain=0
def larg(num,largest_mountain):
if num>largest_mountain:
largest_mountain=num
return largest_mountain

while True:
data1=input()
if data1=="":
break
else:
largest_mountain=larg(int(data1),largest_mountain)

print(largest_mountain)

output:
Traceback (most recent call last):
File “prog.py”, line 9, in
data1=input()
EOFError

Did you provided the custom input in codechef ?
Usually this occurs if you dont provide any input .

not custom input

That’s why , now provide custom input before executing.


still not working

can’t help sorry and if you look up this error in google there are many threads asking the same stuff .

bro give link to your solution

I think you are new here :smile:

for t in range(int(input())):
 n=int(input())
 seq=[]
 for i in range(n):
  seq.append(int(input()))
 print(max(seq))

That’s it
The reason there was an error was that you were reading until you got an error as while reading the last line you won’t read “” you’ll instead get eof error

2 Likes

Also use ``` while writing code above and below to format it correctly.

1 Like