Learn practical skills, build real-world projects, and advance your career
Updated 3 years ago
!pip install jovian --upgrade --quiet
import jovian
Question 1: The user will enter a list of numbers and a separate number. The program will display the index at which the number is present in the list. If the number is absent, it'll return -1. Do NOT use built-in functions for searching.
input=['a','b','c','d','e','f','g','h']# let it be the list from where the item needs to be selected ie. sample list
m='g' # Let the user wants to check whether the m and n strings belong to that list or not
n='x'
o=len(input)
print(o)
8
#true case
i=1
k=input[0]
while(i<=o):
t=input[i]
i=i+1
if(m==t):
break
elif(not(m in input)):
i=-1
break
print(i)
7