Here is what it wrote:
Code: Select all
while True:
letter_to_number = {chr(97 + i): 7 * (i + 1) for i in range(26)} # 97 is the ASCII code for 'a'
# Function to calculate the sum of assigned values for a word
def word_to_number(word):
word = word.lower() # Convert the word to lowercase for case-insensitivity
total = sum(letter_to_number.get(letter, 0) for letter in word)
return total
# Input a word from the user
input_word = input("Enter a word: ")
# Calculate and print the sum of assigned values for the word
result = word_to_number(input_word)
print(f"The sum of assigned values for '{input_word}' is: {result}")