Problem Description
Write a program to search a element linearlyCODING ARENA
a=int(input())
x=[]
for i in range(a):
b=int(input())
x.append(b)
key=int(input())
for i in range(a):
if(key==x[i]):
print("Element is present at index",i)
break
Test Case 1
Input (stdin)5 2 3 4 10 40 3
Expected OutputElement is present at index 1
Test Case 2
Input (stdin)5 2 3 4 10 40 10
Expected OutputElement is present at index 3
No comments:
Post a Comment