ProgrammingHardTCS CodeVita · Infosys HackWithInfy
What is printed?
What is printed?
print(''.join(chr(ord('a') + (ord(c) - ord('a') + 3) % 26) for c in 'xyz'))- A. bcd
- B. abc
- C. uvw
- D. xyz
Correct answer: B. abc
This is a Caesar shift by 3 with wrap-around modulo 26. x, y and z move to a, b and c.
More Python Programming questions
- What is printed? python import math print(len(str(math.factorial(200))))
- What is printed? python import bisect print(bisect.bisectleft([1, 1, 1], 1), bisect.bisectright([1, 1, 1], 1))
- What is printed? python print(0.1 0.1 == 0.01, round(0.1 0.1, 2) == 0.01)
- What is printed? python print(list(filter(None, [0, 1, '', 'a', None, [], [0]])))
- What is printed? python x = 5 print(x.add(3), (5).bitlength(), 5 .real)
- What is printed? python print({{'a': 1, 'b': 2}, 'a': 3})