ProgrammingHardTCS CodeVita · Infosys HackWithInfy

What is printed?

What is printed?
print(''.join(sorted('banana', reverse=True)), len(set('abcABC'.lower())), 'ABC'.isupper())
  1. A. aaabnn 3 True
  2. B. nnbaaa 3 True
  3. C. nnbaaa 6 True
  4. D. nnbaaa 3 False

Correct answer: B. nnbaaa 3 True

Reverse sorting puts n first, then b, then the three a's. Lowercasing gives abcabc, which has three distinct letters. 'ABC'.isupper() is True.

More Python Programming questions

Exams that ask this topic