Python: base code written by AI (Chat GPT)

Post Reply
hudatolah
Site Admin
Posts: 143
Joined: Thu Apr 04, 2013 8:10 pm
Are You a Headhunter?: Affirmative
Surfer?: Yes

Python: base code written by AI (Chat GPT)

Post by hudatolah » Tue Nov 21, 2023 10:41 am

I told Chat GPT to write a similar code to my SUM it up and see if you're compatible script.
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}")
It even inserted to comments (# ... ) on its own to help me understand what it was doing
The Blackholesurfer. My surfboard has teeth.

Post Reply