Write a program that lets the user enter a string and then the program prints out the character that appears most frequently in the string.

Write in Python.
8.10

# Program to find the most frequent character in a string

# Get the string from the user
string = input("Enter a string: ")

# Create an empty dictionary
char_count = {}

# Iterate through the string and count the frequency of each character
for char in string:
if char in char_count:
char_count[char] += 1
else:
char_count[char] = 1

# Find the character with the highest frequency
max_char = ""
max_count = 0

for char in char_count:
if char_count[char] > max_count:
max_char = char
max_count = char_count[char]

# Print the result
print("The most frequent character is '" + max_char + "' with a frequency of " + str(max_count) + ".")