Back

codekata

Created 1 year ago
93 Views
1 Comments
Malar4R7GUX
@Malar4R7GUX
Malar4R7GUX
@Malar4R7GUXProfile is locked. Login

both test cases failed in codekata but working fine with colab.Please advise.


Given a number n followed by n numbers print the number which is greater than 15 if there is no number exits print -1

Input Description:
0<n<100 Given a number n Followed by n number in next line

Output Description:
Print the number which is greater than 15 if there is no number exits print -1

Sample Input : 3 5 7 4


Sample Output : -1



def max_num(n,a):
  result =[]
  for i in range(n):
    if a[i]>15:
      result.append(a[i])
      return result
  else:
      return '-1'      
n = int(input())
a = list(map(int,input().split()))
max_num(n,a)
Comments
Please login to comment.