added python topic

pull/5/head
Ananthakrishnan Nair RS 2020-12-16 19:41:12 +05:30 committed by GitHub
parent 21a2243677
commit 33237f7d84
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 0 deletions

View File

@ -0,0 +1,12 @@
def linear_search(a, x):
for i in range(len(a)):
if a[i] == x:
return i
return -1
a = [1,4,7,9,14,17,39,56]
x = 8
y = 39
print(linear_search(a,x))
print(linear_search(a,y))