In this we are going to see a basic example of Occurrences of Each Letter and Word Count in Python in Python Programming Language.
def count_occurrences()_
occurence = {}
str1 = "Help For Coders"
str2 = str1.split(" ")
print("No. of Words: ",len(str2))
for i in str1:
if i in occurence:
occurence[i] += 1
elif i == " ":
continue
else:
occurence[i] = 1
print(occurence)
count_occurrences()
# Coded By Dhiraj Shelke
#ENJOY CODING
Post a Comment
FOR ANY DOUBTS AND ERRORS FEEL FREE TO ASK. YOUR DOUBTS WILL BE ADDRESSED ASAP