QuestionQ1

Python Basics

Which of the following produces this list?

[65, 66, 67, 68]

  • A range(1,4) + 64
  • B for x(4)+64
  • C map(ord, ג€ABCDג€)
  • D range(4)+ 65
Explanation

Applying ord to each character in ABCD returns its numeric character code: A is 65, B is 66, C is 67, and D is 68. In Python 2, map(ord, 'ABCD') returns those values as a list.

Community Discussion

No comments yet. Be the first to start the discussion!