The version of Python being used is 2.7.
Martin is a commander in the army. An
undercover agent shares some secret
information with him. The secret information
consists of a text and the name of a terrorist.
With the given information, Martin reeds to
find the number of terrorists who are going to
attack the army base. The agent gave Martin a
hint that the number of terrorists is the
number of times the terrorist's name occurs in
the text.
Write an algorithm to helo Martin find the
number of terroriscs who are going to attack
the army base.give the program for this question
Answers
Answered by
7
Answer:
i can't understand
Explanation:
Answered by
4
Answer:
def number_of_terrorists(text,name):
terrorists = text.casefold().count(name.casefold())
print(terrorists)
text = str(input())
name = str(input())
number_of_terrorists(text,name)
Explanation:
example output:
Timisverybodandtimisterrrorist
Tim
2
Timisverybodandtimisterrrorist
tim
2
the funtion takes two parameters and it counts the terrorist name
without considering case sensitive.
Similar questions