Skip to content

Commit 610b815

Browse files
Merge branch 'master' into master
2 parents de04476 + 62ed230 commit 610b815

2 files changed

Lines changed: 14 additions & 0 deletions

File tree

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,13 @@
1+
# linear search of an item in the list inputted by the user
12

3+
l = map(int, raw_input().split()) #enter space separated entries in a list
4+
item = input() #item to be searched for
5+
found = 0 #check to find if th eitem has been found or not
6+
7+
for i in range(len(l)): #iterating through the array
8+
if(l[i] == item): #if element found
9+
found = 1
10+
print('Item found in the list at index position : ' + str(i))
11+
break
12+
if(found == 0): #if element not found
13+
print("Sorry, Item not found in the list ")

SimpleAddition/Sum_2_numbers.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
12
# first lets get 2 numbers to add
23
print "enter 2 number to add"
34

@@ -22,3 +23,4 @@
2223
# and now lets print the numbers
2324
print "the addition of the 2 numbers is "
2425
print sum
26+

0 commit comments

Comments
 (0)