Converting Words/Numbers to Discord “Letter/Number Emojis”


So i am a beginner to python (and programming overall) and i decided that it would be funny if i wrote a program that could convert Letters/Numbers to these “Letter Emojis” in Discord. It works but i am quite unsure if this is the best way to do it. There are also some bugs caused by adding spaces before actually typing Letters/Numbers. I commented it as precisely as I could to make the Code as understandable as possible

from tkinter import *   root = Tk()   # defines the funtion click which gets called when the submitButton1 is pressed def click():     # makes sure the list is empty in case the user presses the button again to convert something new     result.clear()     # saves the text which is entered in the textentry box, this later gets converted to "Discord Letters"     entered_text=textentry.get()     # deletes the output box in case the user presses the button again to convert something new     output.delete(1.0, END)     # the function to convert a String to "Discord Letters"     discord(entered_text)     # loop which gets the length of the string typed in the textentry box and then outputs it to the output textbox     for i in range(len(entered_text)):         output.insert(END, result[i])   # A List in which the converted Letters are stored it's later used to output the converted Letters in a Textbox result = []   # the function to convert a String to "Discord Letters" def discord(word):     # List of numbers from 0-9 , is used to check the string for numbers and then convert them     # to "Discord Digits" since they have a different syntax in discord than Letters     chars = set('0123456789')     s = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v',          'w', 'x', 'y', 'z'}     # In case the User enters spaces they get removed since they just cause trouble     word = word.replace(" ", "")     word = word.lower()     w = word     for i in range(len(w)):         # checks if the string has a number and outputs accordingly         if any((c in chars) for c in w[i]):             list_one = ["zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", ]             result.append(':' + list_one[int(w[i])] + ":" + " ")         # checks if the string has letter and outputs accordingly (might be unnecessary)         elif any((c in s) for c in w[i]):             result.append(':regional_indicator_' + w[i] + ":" + " ")         else:             # In case the user inputs something wrong             print("False Input")   root.title("Discord Letter Converter") # TextInput textentry = Entry(root, width=20, bg="white") textentry.pack() # submitButton submitButton1 = Button(root, text="Submit", width=6, command=click)# submitButton1.pack() # TextOutput output = Text(root, width=75, height=6, wrap=WORD, background="white") output.pack() root.mainloop() ```