The following code:
print(ord('c') - ord('a')) prints:
- 0
- 3
- 1
- 2
Explanation: The ord() function in Python returns the Unicode code of the given character. A lower-case c returns 99, and a lower-case a returns 97. Therefore, 99 minus 97 equals 2. This is what is printed in the console.
More Questions: Python Essentials 2 – Module 2 Test
Please login or Register to submit your answer