ProgrammingModerateCAT · MBA placement
What is printed?
What is printed?
import math print(math.comb(10, 3), math.gcd(12, 18, 24), math.lcm(4, 6, 10))
- A. 120 2 60
- B. 90 6 60
- C. 120 6 120
- D. 120 6 60
Correct answer: D. 120 6 60
math.comb(10, 3) is 120, math.gcd takes several arguments from Python 3.9, and math.lcm(4, 6, 10) is 60.
More Python Programming questions
- What is printed? python import itertools print(sum(b - a for a, b in itertools.pairwise([1, 4, 2, 8])))
- What is printed? python g = [[0] 3] 2 g[0][1] = 5 h = [[0] 3 for in range(2)] h[0][1] = 5 print(g, h)
- What is printed? python import heapq h = [] for w, name in [(2, 'b'), (1, 'z'), (2, 'a'), (1, 'c')]: heapq.heappush(h, (w, name)) out = []…
- What is printed? python recs = [('a', 2), ('b', 1), ('c', 2), ('d', 1)] print([n for n, v in sorted(recs, key=lambda r: r[1]…
- What is printed? python pairs = list(zip([1, 2, 3], 'ab', [True])) print(pairs, len(list(zip())))
- What is printed? python def threeless(a, t): a = sorted(a) n = len(a) c = 0 for i in range(n - 2): l, r = i + 1, n - 1 while l < r: if…