Python ProgrammingPython Programming

Python count number of string appears in given string

txt = "I love Canada, Canada is one of the most impressive countries in the world. Canada is a great country."

x = txt.count("Canada")

print(x)
Output
3