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=(input("Enter the numbers :").split(","))
c=len(a)
b=int(input("Enter another number :"))
i=0
while (i<c):
if (int(a[i])==b):
print("List has an equal number at index ",i)
break
i=i+1
if(i==c):
print("-1")
Enter the numbers :22,45,67,89
Enter another number :89
List has an equal number at index 3