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.

s=eval(input('Enter a list of numbers inside [] separated by comma : '))
num=eval(input('Enter a number to be searched : '))
for i in range(len(s)):
    if s[i]==num:
        print("The first occurence of num is at position ",i+1)
        break
else:
    print(-1)
Enter a list of numbers inside [] separated by commas : [1,2,3,3,4,5] Enter a number to be searched : 3 The first occurence of num is at position 3