Comma-separated elements
This snippet can be used to turn a list of strings into a single string with each element from the list separated by commas.
Python: 3.0    Fatos Morina    03 Jul 2021   0
Login to upvote
1
2
3
4
hobbies = ["basketball", "football", "swimming"]

print("My hobbies are:") # My hobbies are:
print(", ".join(hobbies)) # basketball, football, swimming
Copy | Download as: .py file   PNG
Share on: FB   Twitter   LinkedIn   WA
©2021 - code108labs   Contributors   Hosted on DigitalOcean   Partner website: pythoncircle.com