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.
n=int(input("TheNumberOfElemenTInList:"))
A=[]
i=0
while(i < n) :
j=input("Enter {} number of the list:".format(i+1))
A.insert(i , j)
i+=1
J=input("enter the no.:")
if j in A:
h=A.index(j)
print(h)
else:
print("-1")
TheNumberOfElemenTInList:4
Enter 1 number of the list:12
Enter 2 number of the list:3
Enter 3 number of the list:4
Enter 4 number of the list:5
enter the no.:4
3