Python - Input and Output
You want to print a list of items on the same line separated by commas, but without a trailing comma at the end. Which code achieves this?
join() on a list of strings creates a single string with commas between items and no trailing comma.print(*items, sep=', ') prints items separated by commas but no trailing comma; however, if items are not strings, it fails. print(items, sep=', ') prints the list as one object. print(items, end=', ') adds comma after entire list.15+ quiz questions · All difficulty levels · Free
Free Signup - Practice All Questions