ProgrammingHardTCS NQT · Accenture
What is printed?
What is printed?
print('%c%c' % (72, 105), chr(0x263A) == '\u263a', ord('A') + 1, chr(ord('a') + 25))- A. Hi False 66 z
- B. Hi True 65 z
- C. Hi True 66 z
- D. Ho True 66 z
Correct answer: C. Hi True 66 z
%c turns the integers 72 and 105 into H and i. chr and ord are inverses, so the smiley escape matches its literal, and ord('A') + 1 is 66.
More Python Programming questions
- What is printed? python print(sum(i i for i in range(10)), sum(range(10)) 2 == sum(i 3 for i in range(10)), sum(range(10)) 2)
- What is printed? python print(f'{3.14159:.2}', f'{"abc":.2}', f'{0.5:.0%}')
- What is printed? python from fractions import Fraction print(Fraction(1, 2) + 0.5 == 1, Fraction(1, 3) 3 == 1, type(Fraction(1, 2) +…
- What is printed? python print(max(-3, 2, key=abs), min(-3, 2, key=abs), sorted([-3, 2, -2], key=abs), sorted([-3, 2, -2], key=lambda v…
- What is printed? python print(1 - 0.9 == 0.1, round(1 - 0.9, 1) == 0.1, 1 - 0.9 > 0.09, 1 - 0.9)
- What is printed? python print(len('a1b22c333'.split('2')), ''.join(c for c in 'a1b22c333' if c.isdigit()), len('a1b22c333'))