How to count the number of times (occurrences) a word appears in a string with Python

1 Answer

0 votes
s = "Python is an interpreted, high-level, general-purpose programming language." \
    "Python emphasizes code readability"

c = s.count("Python")

print(c)


'''
run:

2

'''

 



answered Dec 20, 2018 by avibootz
edited Dec 20, 2018 by avibootz
...