ProgrammingVery hardTCS CodeVita · Infosys HackWithInfy
What is printed?
What is printed?
print(10 in range(0, 20, 5), 11 in range(0, 20, 5))
- A. True True
- B. False True
- C. True False
- D. False False
Correct answer: C. True False
range(0, 20, 5) holds 0, 5, 10 and 15. Membership in a range is checked arithmetically, so 10 is in it and 11 is not.
More Python Programming questions
- What is printed? python print(sum(range(1, 101)) 2 - sum(i i for i in range(1, 101)))
- What is printed? python print(len(str(264)), sum(map(int, str(264))))
- What is printed? python print(all(int(c) % 2 == 0 for c in '24680'), any(c in 'aeiou' for c in 'rhythm'))
- What is printed? python print(''.join(c.upper() if i % 2 else c for i, c in enumerate('python')))
- What is printed? python print(' '.join(w[::-1] for w in 'hello big world'.split()))
- What is printed? python print(max(len(w) for w in 'the quick brown fox'.split()), [w for w in 'the quick brown fox'.split() if len(w) == 5])