fork download
  1. def xyz(a,n):
  2. for i in range(0,len(a)):
  3. if a[i]==n:
  4. return I
  5. return-1
  6. a=[1,2,3,4,5,6,7,8,9]
  7. n=int(input("Enter the number to search:"))
  8. r=xyz(a,n)
  9. if r!=-1:
  10. print("item found at index",str(r))
  11. else:
  12. print("item not found")
Success #stdin #stdout 0.04s 9760KB
stdin
8
stdout
Enter the number to search:item not found