ProgrammingHardTCS CodeVita · Infosys HackWithInfy
What is printed?
What is printed?
import math print(math.gcd(12, 18, 27), math.lcm(4, 6), math.gcd())
- A. 3 24 1
- B. 3 12 1
- C. 3 12 0
- D. 6 12 0
Correct answer: C. 3 12 0
math.gcd takes any number of arguments since Python 3.9 and gcd() with no arguments is 0. lcm(4, 6) is 12. gcd(12, 18, 27) is 3.
More Python Programming questions
- What is printed? python print(divmod(-(10 20), 7))
- What is printed? python import heapq h = [4, 1, 3] heapq.heapify(h) print(h[0], sorted(h))
- What is printed? python from collections import deque d = deque([1, 2, 3, 4, 5], maxlen=3) d.append(6) d.appendleft(0) print(list(d))
- What is printed? python x = [0] 3 y = [[0] 2] 2 y[0][1] = 7 print(x, y)
- What is printed? python import bisect vals = [10, 20, 30] print(bisect.bisectleft(vals, 0), bisect.bisectleft(vals, 35)…
- What is printed? python from collections import deque d = deque('abcde') d.rotate(2) print(''.join(d), ''.join(deque('abcde').reversed()))