Respuesta :
Answer:
In Python:
chars = 'abcdefghijklmnopqrstuvwxyz'
letter = input("Sentence: ")
for i in range(len(chars)):
count = 0
for j in range(len(letter)):
if chars[i] == letter[j].lower():
count = count + 1
if count > 0 :
print(chars[i]+": "+str(count)+" times")
Explanation:
This initializes the characters of alphabet from a-z
chars = 'abcdefghijklmnopqrstuvwxyz'
This prompts the user for sentence
letter = input("Sentence: ")
This iterates through the initialized characters
for i in range(len(chars)):
This initializes count to 0
count = 0
This iterates through the input sentence
for j in range(len(letter)):
This compares the characters of the sentence with alphabet a-z
if chars[i] == letter[j].lower():
If there is a match, count is incremented by 1
count = count + 1
If there is an occurrence of character,
if count > 0 :
The character and its count is printed
print(chars[i]+": "+str(count)+" times")
In this exercise we have to use the knowledge of computational language in Python, so we have that code is:
It can be found in the attached image.
So, to make it easier, the code in Python can be found below:
chars = 'abcdefghijklmnopqrstuvwxyz'
letter = input("Sentence: ")
for i in range(len(chars)):
count = 0
for j in range(len(letter)):
if chars[i] == letter[j].lower():
count = count + 1
if count > 0 :
print(chars[i]+": "+str(count)+" times")
See more about python at brainly.com/question/26104476
