🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Strings Quiz: all 8 questions

Strings Quiz · Question 3 of 8

What does this print? (code)

What does this print?

s = "  the sky  is blue "
print(" ".join(reversed(s.split())))
Answer & explanation

Correct answer: blue is sky the

split() with no argument drops extra spaces, reversed() flips the word order, join() puts single spaces back.

Can you get the rest right without peeking?

Take the timed Strings Quiz quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →