We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents de04476 + 62ed230 commit 610b815Copy full SHA for 610b815
2 files changed
SearchingAlgorithms/Linear_Search.py
@@ -1 +1,13 @@
1
+# linear search of an item in the list inputted by the user
2
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
@@ -1,3 +1,4 @@
# first lets get 2 numbers to add
print "enter 2 number to add"
@@ -22,3 +23,4 @@
22
23
# and now lets print the numbers
24
print "the addition of the 2 numbers is "
25
print sum
26
0 commit comments