ProgrammingHardTCS NQT · Accenture

What is printed?

What is printed?
print(sorted('bca', reverse=True)[0], 'bca'.index('c'))
  1. A. a 2
  2. B. c 2
  3. C. c 1
  4. D. b 2

Correct answer: C. c 1

Reversed sorting puts c first, and index returns the position of c in bca, which is 1 because b comes before it.

More Python Programming questions

Exams that ask this topic