def calculate_whitespace_ratio(string):
total_chars = len(string)
whitespace_chars = string.count(' ')
ratio = whitespace_chars / total_chars
return ratio
A = "Олег купил цедию"
whitespace_ratio = calculate_whitespace_ratio(A)
print("Доля пробелов в строке A:", whitespace_ratio)
To embed this program on your website, copy the following code and paste it into your website's HTML: