I am trying to output in the format (a, b and c) from a function that should print common letters from 2 strings, but what I currently get is (a,b,and,c).
def task10(str1,str2):
str1=str1.lower()
str2=str2.lower()
ch1=""
ch2=""
for i in str1:
if i.isalpha():
ch1+=i
for k in str2:
if k.isalpha():
ch2+=k
common = list(set([c for c in ch1 if c in ch2]))
s=len(common)
if s==0:
common=['no common letters']
common.sort()
if s>1:
common.insert(-1," and ")
common= ', '.join(common)
common = common.replace(', and ,', 'and')
print(f'{common}')
task10("i like big cups","i cannot lie")