Computer Science, asked by ajayprhaveenn, 3 months ago

Write a python program to search a string in the given list​

Answers

Answered by mannat200891
0

Answer:

We can also use count() function to get the number of occurrences of a string in the list. If its output is 0, then it means that string is not present in the list. l1 = ['A', 'B', 'C', 'D', 'A', 'A', 'C'] s = 'A' count = l1. count(s) if count > 0: print(f'{s} is present in the list for {count} times.

Similar questions