We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 44d2b79 commit dc11dbfCopy full SHA for dc11dbf
1 file changed
CompetitiveProgramming/HackerEarth/Algorithms/Searching/P05_SimpleSearch.py
@@ -0,0 +1,40 @@
1
+# Given a List of Distinct N number a1,a2,a3........an.
2
+# Find The Position Of Number K In The Given List.
3
+#
4
+# Input Format
5
6
+# First Line Take Input Value Of N
7
8
+# Second Line Take Input N Space Separated Integer Value
9
10
+# Third Line Take Input Value Of K
11
12
+# Output Format
13
14
+# Position Of K In The Given List
15
16
+# Constraints
17
18
+# 0 < N < 100001
19
+# 0 < ai < 100001
20
+# 0 < K < 100001
21
22
+# NOTE:
23
+# Array Indexing Starts From 0
24
25
+# SAMPLE INPUT
26
+# 5
27
+# 1 2 3 4 5
28
+# 4
29
30
+# SAMPLE OUTPUT
31
+# 3
32
+
33
+n = int(input())
34
+array = [int(i) for i in input().split()]
35
+k = int(input())
36
37
+for i in range(len(array)):
38
+ if array[i] == k:
39
+ print(i)
40
+ break
0 commit comments