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.
a=[]
newnum=1
check=False
while True:
newnum=input("enter your list of numbers one by one, when finished type done:")
if newnum=="done":
break
else:
a.append(float(newnum))
print("You entered the list", a)
searchnum=float(input("enter the number you want to find the index to:"))
for i in range(0,len(a)):
if searchnum==a[i]:
print(i)
check=True
if check==False:
print(-1)