Learn practical skills, build real-world projects, and advance your career
!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.

list = []
n = int(input("Enter number of elements : "))
for i in range(0, n):
            nums = int(input())
            list.append(nums) 
print(list)
num=int(input("enter number:"))
if num in list:
    print(list.index(num))
else:
    print("-1")

Enter number of elements : 6 2 4 6 7 8 9 [2, 4, 6, 7, 8, 9] enter number:56 -1