what I'm trying to do is take the entered string separated by commas and change it to list then for each list as a key print the associated value.
def main():myDict = {'a':1, 'b':2, 'c':3, 'd':4, 'e':5....}u_input = input("Enter a letter")myList = [x.strip() for x in u_input.split(',')]result = searchDict(myList)print(result)def searchDict(key):for ml in key:value = myDict.get(ml, "not found")re = []re.append(value)print('-'.join(re)) #this one shows each value for each entered key separated by comma but it does not print it in one line also prints 'None' on the end#res = '-'.join(re)#return res //this only shows the value for the first key only even if I enter multiple lettermain();
The prob is that, if I return 'res' instead of printing it, I'm only getting the first key value.
output with print(if I enter a, b): 1, 2, none
output with return 1