ProgrammingHardProduct-company MCQ pattern

What is printed?

What is printed?
print('Hello World'.swapcase().title(), 'tEST'.capitalize(), 'x'.isalpha(), '1.5'.isdigit(), '١٢'.isdigit())
  1. A. Hello World Test False False True
  2. B. Hello World Test True False True
  3. C. Hello World Test True True True
  4. D. Hello World Text True False True

Correct answer: B. Hello World Test True False True

swapcase then title restores the capitals, and capitalize lowercases the rest. isdigit accepts Unicode digits such as Arabic-Indic ones, but fails on the dot in '1.5'.

More Python Programming questions

Exams that ask this topic