defalphabet_position(text):
position_list =[]
alphabet_set ={}
string ="abcdefghijklmnopqrstuvwxyz"for(index,ch)inenumerate(list(string),1):
alphabet_set[ch]= index
for c inlist(text.lower()):if c inlist(string):
position_list.append(str(alphabet_set[c]))return" ".join(position_list)
Suggested Answer
defalphabet_position(text):
alphabet ='abcdefghijklmnopqrstuvwxyz'return' '.join(str(alphabet.index(x)+1)for x in text.lower()if x.isalpha())