PRACTICE

Splitting & Joining Text

Lesson notes

Your task

Split "red green blue" into words, then print the words joined with a comma and no spaces.

Expected output
red,green,blue
Loading…

OUTPUT

Worked solution
text = "red green blue"
print(",".join(text.split()))

Checks compare printed output, not your approach. Several solutions can be valid.

← Back to courses