def text_list(listtext,sep1=", ", sep2=", and ") n=listtext.size if n>1 : (listtext.first(n-1)).join(sep1) + sep2 +listtext.last else listtext.first end end text_list(["cat", "dog", "bird"]) => "cat, dog, and bird"
You need to create an account or log in to post comments to this site.