Please find out how many times the sub-strings "cen", "com", "der", "hen", and "ven" show in the text. The results need to come out separately, such as cen = 3 and etc.
I know how to find out how many times a single sub-string shows up. I can make a code for how many times a single sub-string can show up, but how do I change the code into finding multiple sub-strings.
Can someone show me how to do this problem?
I need to put the results into a list so that it turns out to be like:
Code:-
list1 = ["cen", "com", "der", "hen","ven"]
list2 = []
list2 = [1,3,5]
Here is a successful code for finding how many times 1 sub-string will appear.
Code:-
string = "Cryptography is the practice and study of techniques for secure communication in the presence of third parties called adversaries. More generally, cryptography is about constructing and analyzing protocols that prevent third parties or the public from reading private messages; various aspects in information security such as data confidentiality, data integrity, authentication, and non-repudiation are central to modern cryptography. Modern cryptography exists at the intersection of the disciplines of mathematics, computer science, electrical engineering, communication science, and physics. Applications of cryptography include electronic commerce, chip-based payment cards, digital currencies, computer passwords, and military communications."
substring = "is"
count = string.count(substring)
print("The count is:", count)
bit.ly/2K70Axe