ProgrammingHardTCS CodeVita · Infosys HackWithInfy
What is printed?
What is printed?
print(2 ** 3 ** 0, (2 ** 3) ** 0)
- A. 2 1
- B. 1 1
- C. 8 1
- D. 2 8
Correct answer: A. 2 1
** is right-associative, so 3 ** 0 is 1 and 2 ** 1 is 2. The parenthesised form is 8 ** 0, which is 1.
More Python Programming questions
- What is printed? python print(7 & 3 | 4 ^ 1)
- What is printed? python print(5 <= 5 < 6 != 7, 1 < 2 > 3)
- What is printed? python print(len('') or 'empty', [] or 'none')
- What is printed? python a = [1, 2, 3] b = a[:] a.append(4) print(len(a), len(b))
- What is printed? python print(list(filter(lambda s: s.startswith('a'), ['ab', 'ba', 'ac'])), ' a b '.strip().split(' '))
- What is the time complexity of x in d where d is a collections.deque of n items?