Answered You can hire a professional tutor to get the answer.
Can you help me as my program isn't working if the string contains numbers as well as upper and lower case letters. he program is attached below and
Can you help me as my program isn't working if the string contains numbers as well as upper and lower case letters.
he program is attached below and is written in python 3.
def max_relative_frequency(s):
# store uppercases and lowercases
uppercases = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
lowercases = 'abcdefghijklmnopqrstuvwxyz'
# generate a list of 26 values to store the frequency of each alphabet
frequency = [0 for i in range(len(uppercases))]
# check each character of the s
for i in range(len(s)):
# check for uppercase
if s[i] in uppercases:
frequency[uppercases.index(s[i])] += 1
# check for lowercase
elif s[i] in lowercases:
frequency[lowercases.index(s[i])] += 1
# find the maximum of the frequency
maximum = max(frequency)
# return the maximum frequency
return maximum/(len(s)-s.count(' ')-s.count('.')-s.count(';')-s.count(','))