ProgrammingHardTCS CodeVita · Infosys HackWithInfy
What is printed?
What is printed?
print(chr(ord('a') + 27), ord('Z') - ord('A'), chr(0x1F600) == '\U0001F600', len('\U0001F600'))- A. | 25 True 4
- B. | 25 False 1
- C. | 26 True 1
- D. | 25 True 1
Correct answer: D. | 25 True 1
ord('a') + 27 is 124, the code point of '|'. ord('Z') - ord('A') is 25. The escape \U0001F600 is one code point, so its length is 1 in Python 3.
More Python Programming questions
- Which of the following Python operations on a built-in container is O(1) on average (independent of the container size)?
- Timsort is the algorithm behind Python's sorted(). For an input that is already in ascending order, what is its running time?
- What is printed? python print(10 17 in range(0, 10 18, 2), 10 17 + 1 in range(0, 10 18, 2))
- What is printed? python def add(x, memo={}): memo[x] = len(memo) return memo print(add(5), add(7))
- What is printed? python print(min('10', '9'), min(10, 9), max('10', '9', key=int))
- What is printed? python i = 'x' = [i for i in range(3)] print(i)