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.
c=[]
print("enter the length of array/n")
n=int(input()) # reson for entering int is that if user enter 2.2 then loop will not run and this is for all program from now
l=n
print("/n enter the data")
for i in range(0,n):
a=input()
c.append(a) # array formed
print("/n enter a data to be searched in the array /n")
x=input()
v=0 # assing for further use
print("/n")
for i in range(0,l):
z=c[i]
if z==x:
print(i)
v=1
break
if v==0:
print("Number not present")