write a program to accept any number from user and search it in a list of values, if number is found then display a message "number found" other wise display a message number not found
Answers
Answered by
1
Answer:
Input: arr[] = {10, 5, 3, 4, 3, 5, 6}
Output: 5 [5 is the first element that repeats]
Input: arr[] = {6, 10, 5, 4, 9, 120, 4, 6, 10}
Output: 6 [6 is the first element that repeats]
Answered by
1
Answer:
number=int(input("Enter number:"))
numlist=[2,5,8,1,3,9,12,45] #if it is given just #replace the numbers
l=len(numlist)
flag=0
for i in range (0,l):
if number==numlist [i]:
#print ("number found")
flag+=1
#break
if flag==0:
print ("number not found")
else:
print ("number found") # flag times #occurence--->
#print("number found",flag,"times")
#hope it will work
Similar questions