ProgrammingModerateTCS NQT · Accenture
What is printed?
What is printed?
x = 'abc' print(x.islower() and x.isalpha(), ''.isdigit())
- A. True True
- B. True False
- C. False False
- D. False True
Correct answer: B. True False
abc is all lowercase letters, so both checks pass. An empty string has no digits, so isdigit returns False.
More Python Programming questions
- What is printed? python it = iter('ab') print(next(it), list(it), next(it, 'end'))
- What is printed? python print([n for n in range(8) if n and n & (n - 1) == 0])
- What is printed? python import heapq a = [5, 1, 4] heapq.heapify(a) print([heapq.heappop(a) for in range(len(a))], a)
- What is printed? python vals = [y for x in range(5) if (y := x x) % 2 == 0] print(vals)
- What is printed? python from functools import partial f = partial(int, base=2) print(f('101'), f('11', base=10))
- What is printed? python print(list(zip([(1, 'a'), (2, 'b')])))