ProgrammingModerateTCS NQT · Accenture
What is printed?
What is printed?
print(abs(-0), abs(-2.5), -(-3))
- A. 0 -2.6 3
- B. 0 2.5 -4
- C. 0 2.5 3
- D. 1 2.5 3
Correct answer: C. 0 2.5 3
abs returns the magnitude of its argument, and negating -3 gives 3.
More Python Programming questions
- What is printed? python print(hex(255), oct(8), bin(-5))
- What is printed? python print(chr(0x41), ord('n'))
- What is printed? python from collections import Counter a = [1, 1, 2, 3, 3] c = Counter(a) print(sum(c[x] c[4 - x] for x in c))
- What is printed? python def nlis(a): n = len(a) L = [1] n C = [1] n for i in range(n): for j in range(i): if a[j] < a[i]: if L[j] + 1 >…
- What is printed? python print(bin(29 ^ 15).count('1'))
- What is printed? python from functools import lrucache @lrucache(maxsize=None) def p(n, m): if n == 0: return 1 if n < 0 or m == 0: return…