ProgrammingModerateTCS NQT · Infosys

What is printed?

What is printed?
print(' '.join(w[::-1] for w in 'hello big world'.split()))
  1. A. olleh gib dlrow
  2. B. olleh big world
  3. C. hello gib dlrow
  4. D. olleh gib dlrom

Correct answer: A. olleh gib dlrow

split() breaks the sentence into words, each word is reversed by slicing, and join puts single spaces back between them.

More Python Programming questions

Exams that ask this topic