Computer Science, asked by nanditjindal4132, 5 months ago

Program to Input a list/tuple of elements, search for a given element in the list/tuple and frequency and position of search
element.

Answers

Answered by dreamrob
5

Program:

L = []

n = int(input("Enter no. of elements in the list : "))

print("Enter elements in the list : ")

for i in range(0 , n):

   ele = input()

   L.append(ele)

Search = input("Enter element to search : ")

c = 0

for i in range(0 , n):

   if L[i] == Search:

       c = c + 1

       print("Present at position : " , i)

if c > 0 :

   print("Frequency : " , c)

else:

   print("Element not found")

Similar questions