import string def getLetterFrequency (phrase: str): letters = [0 for i in range(26)] #creates a list called letters that has 26 elements all set to 0 # write your code here to update letters with the proper values return letters def main(): phrase input("Enter a short phrase: ") frequency = getLetter Frequency (phrase) print("The Frequency of each letter in the phrase is: ") index = 0 for letter in string.ascii_uppercase: print(f"{letter}: {frequency [index]}", end = " ") index + 1 main() You are going to write a function for a program where the overall use of the program is to display the frequence of letters in a string. The function you will write is called getLetter Frequency and it will accept a string as a parameter. It should build a list of 26 integers that represent the frequency of each letter. Index 0 for A's, index 1 for B's and so forth. The function should return the list of letter frequency's. Upper and Lower case letters should be counted as the same letter (ie a == A) This can be done many ways with selections statements and arithmetic. The built in python function ord() will give you the ASCII value of any character. For example ord("A") == 65 and ord("B") == 66
import string def getLetterFrequency (phrase: str): letters = [0 for i in range(26)] #creates a list called letters that has 26 elements all set to 0 # write your code here to update letters with the proper values return letters def main(): phrase input("Enter a short phrase: ") frequency = getLetter Frequency (phrase) print("The Frequency of each letter in the phrase is: ") index = 0 for letter in string.ascii_uppercase: print(f"{letter}: {frequency [index]}", end = " ") index + 1 main() You are going to write a function for a program where the overall use of the program is to display the frequence of letters in a string. The function you will write is called getLetter Frequency and it will accept a string as a parameter. It should build a list of 26 integers that represent the frequency of each letter. Index 0 for A's, index 1 for B's and so forth. The function should return the list of letter frequency's. Upper and Lower case letters should be counted as the same letter (ie a == A) This can be done many ways with selections statements and arithmetic. The built in python function ord() will give you the ASCII value of any character. For example ord("A") == 65 and ord("B") == 66
Chapter8: Arrays
Section: Chapter Questions
Problem 5PE
Related questions
Question
Need help with coding in this in python!
![import string
def getLetterFrequency (phrase: str):
letters = [0 for i in range(26)] #creates a list called letters that has 26 elements all set to 0
# write your code here to update letters with the proper values
return letters
def main():
phrase input("Enter a short phrase: ")
frequency = getLetter Frequency (phrase)
print("The Frequency of each letter in the phrase is: ")
index = 0
for letter in string.ascii_uppercase:
print(f"{letter}: {frequency [index]}", end = " ")
index + 1
main()](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2Fe9220a27-0675-4410-b8f4-21c5a7e08562%2Fcdedf3d2-0817-41cc-95f9-861882f80232%2Fty04rvd_processed.jpeg&w=3840&q=75)
Transcribed Image Text:import string
def getLetterFrequency (phrase: str):
letters = [0 for i in range(26)] #creates a list called letters that has 26 elements all set to 0
# write your code here to update letters with the proper values
return letters
def main():
phrase input("Enter a short phrase: ")
frequency = getLetter Frequency (phrase)
print("The Frequency of each letter in the phrase is: ")
index = 0
for letter in string.ascii_uppercase:
print(f"{letter}: {frequency [index]}", end = " ")
index + 1
main()

Transcribed Image Text:You are going to write a function for a program where the overall use of the program is to display the frequence of letters in a string.
The function you will write is called getLetter Frequency and it will accept a string as a parameter. It should build a list of 26 integers that
represent the frequency of each letter. Index 0 for A's, index 1 for B's and so forth. The function should return the list of letter frequency's.
Upper and Lower case letters should be counted as the same letter (ie a == A)
This can be done many ways with selections statements and arithmetic. The built in python function ord() will give you the ASCII value of
any character. For example ord("A") == 65 and ord("B") == 66
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 2 steps with 1 images

Recommended textbooks for you

EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT

C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning

C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr

EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT

C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning

C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr

Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,

Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:
9781337102124
Author:
Diane Zak
Publisher:
Cengage Learning

Systems Architecture
Computer Science
ISBN:
9781305080195
Author:
Stephen D. Burd
Publisher:
Cengage Learning